Delete Duplicate Posts - Version 4.7.8

Version Description

  • Fix: Reworked JS code - fixing the list of duplicates not loading.
  • Improved loading time by fixing a few logic issues in the JavaScript code.
  • Added optional debug logging to help pinpoint bugs.
  • Updated language file for translations.
  • Cleaning up PHP code.
  • Trimmed CSS file.
Download this release

Release Info

Developer lkoudal
Plugin Icon 128x128 Delete Duplicate Posts
Version 4.7.8
Comparing to
See all releases

Code changes from version 4.7.7 to 4.7.8

css/delete-duplicate-posts-min.css CHANGED
@@ -118,10 +118,6 @@
118
  text-align: center;
119
  }
120
 
121
- .ddpcomparemethod li {
122
-
123
- }
124
-
125
  #ddp_compare_metatag {
126
  margin-top: 10px;
127
  margin-left: 25px;
@@ -199,10 +195,6 @@
199
  border-bottom: 0px;
200
  }
201
 
202
- #sidebar-container .sidebarrow img {
203
-
204
- }
205
-
206
  #sidebar-container .sidebarrow img.logo {
207
  margin-bottom: 10px;
208
  display: block;
118
  text-align: center;
119
  }
120
 
 
 
 
 
121
  #ddp_compare_metatag {
122
  margin-top: 10px;
123
  margin-left: 25px;
195
  border-bottom: 0px;
196
  }
197
 
 
 
 
 
198
  #sidebar-container .sidebarrow img.logo {
199
  margin-bottom: 10px;
200
  display: block;
css/delete-duplicate-posts.css CHANGED
@@ -118,10 +118,6 @@
118
  text-align: center;
119
  }
120
 
121
- .ddpcomparemethod li {
122
-
123
- }
124
-
125
  #ddp_compare_metatag {
126
  margin-top: 10px;
127
  margin-left: 25px;
@@ -199,10 +195,6 @@
199
  border-bottom: 0px;
200
  }
201
 
202
- #sidebar-container .sidebarrow img {
203
-
204
- }
205
-
206
  #sidebar-container .sidebarrow img.logo {
207
  margin-bottom: 10px;
208
  display: block;
118
  text-align: center;
119
  }
120
 
 
 
 
 
121
  #ddp_compare_metatag {
122
  margin-top: 10px;
123
  margin-left: 25px;
195
  border-bottom: 0px;
196
  }
197
 
 
 
 
 
198
  #sidebar-container .sidebarrow img.logo {
199
  margin-bottom: 10px;
200
  display: block;
delete-duplicate-posts.php CHANGED
@@ -5,7 +5,7 @@ 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: 4.7.7
9
  Author: cleverplugins.com
10
  Author URI: https://cleverplugins.com
11
  Min WP Version: 4.7
@@ -244,49 +244,56 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
244
  if ( PAnD::is_admin_notice_active( 'ddp-newsletter-14' ) && in_array( $screen->id, array( 'dashboard', 'tools_page_delete-duplicate-posts', 'plugins' ), true ) ) {
245
  $current_user = wp_get_current_user();
246
  ?>
247
- <div id="cp-ddp-newsletter" data-dismissible="ddp-newsletter-14" class="updated notice notice-success is-dismissible">
248
- <h3>Delete Duplicate Posts Newsletter</h3>
249
- <h4>Please sign up for our newsletter to learn about changes and improvements to the plugin.</h4>
250
- <form class="ml-block-form" action="https://static.mailerlite.com/webforms/submit/l2v7x5" data-code="l2v7x5" method="post" target="_blank">
251
- <table>
252
- <tbody>
253
- <tr>
254
- <td>
255
- <div class="ml-field-group ml-field-name">
256
- <input type="text" class="regular-text" data-inputmask="" name="fields[name]" placeholder="Name" autocomplete="name" style="width:15em;" value="<?php
 
 
257
  echo esc_html( $current_user->display_name ) ;
258
- ?>" required="required">
259
- </div>
260
- </td>
261
- <td>
262
- <div class="ml-field-group ml-field-email ml-validate-email ml-validate-required">
263
- <input type="email" class="regular-text required email" data-inputmask="" name="fields[email]" placeholder="Email" autocomplete="email" value="<?php
 
 
264
  echo esc_html( $current_user->user_email ) ;
265
- ?>" required="required">
266
- </div>
267
- </td>
268
- <td>
269
- <button type="submit" class="button">Subscribe</button>
270
- </td>
271
- </tr>
272
- <tr>
273
- <td colspan="3">
274
- <div class="privacy-policy">
275
- <p>You can unsubscribe anytime. For more details, review our <a href="https://cleverplugins.com/privacy-policy/" target="_blank">Privacy Policy</a>.</p>
276
- </div>
277
- </td>
278
- </tr>
279
- </table>
280
- </table>
281
- <input type="hidden" name="fields[signupsource]" value="DDP Plugin <?php
 
 
 
282
  echo esc_attr( self::get_plugin_version() ) ;
283
  ?>">
284
- <input type="hidden" name="ml-submit" value="1">
285
- <input type="hidden" name="anticsrf" value="true">
286
- </form>
287
- <p><small>Signup form is shown every 14 days until dismissed</small></p>
288
- </div>
289
- <?php
290
  }
291
 
292
  if ( 'tools_page_delete-duplicate-posts' !== $screen->id ) {
@@ -300,38 +307,41 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
300
 
301
  if ( PAnD::is_admin_notice_active( 'cp-ddp-improve-notice-7' ) ) {
302
  ?>
303
- <div id="cp-ddp-freemius" data-dismissible="cp-ddp-improve-notice-7" class="notice notice-success is-dismissible">
304
- <h3><?php
305
  esc_html_e( 'Help Delete Duplicate Posts improve!', 'delete-duplicate-posts' );
306
  ?></h3>
307
 
308
- <p>
309
- <?php
310
  echo esc_html__( 'Gathering non-sensitive diagnostic data about the plugin install helps us improve the plugin.', 'delete-duplicate-posts' ) . ' <a href="' . esc_url( 'https://cleverplugins.com/docs/install/non-sensitive-diagnostic-data/' ) . '" target="_blank" rel="noopener">' . esc_html__( 'Read more about what we collect.', 'delete-duplicate-posts' ) . '</a>' ;
311
  ?>
312
- </p>
313
 
314
- <p>
315
- <?php
316
  // translators:
317
  printf( esc_html__( 'If you opt-in, some data about your usage of %1$s will be sent to Freemius.com. If you skip this, that\'s okay! %1$s will still work just fine.', 'delete-duplicate-posts' ), '<b>Delete Duplicate Posts</b>' );
318
  ?>
319
- </p>
320
- <p>
321
- <a href="javascript:;" class="button button-primary" onclick="cp_ddp_freemius_opt_in(this)" data-opt="yes"><?php
 
322
  esc_html_e( 'Sure, opt-in', 'delete-duplicate-posts' );
323
  ?></a>
324
 
325
- <a href="javascript:;" class="button dismiss-this"><?php
 
326
  esc_html_e( 'No, thank you', 'delete-duplicate-posts' );
327
  ?></a>
328
- </p>
329
- <input type="hidden" id="cp-ddp-freemius-opt-nonce" value="<?php
 
330
  echo esc_attr( wp_create_nonce( 'cp-ddp-freemius-opt' ) ) ;
331
  ?>" />
332
 
333
- </div>
334
- <?php
335
  }
336
 
337
  }
@@ -346,27 +356,31 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
346
  if ( false !== $totaldeleted && 0 < $totaldeleted ) {
347
  $totaldeleted = number_format_i18n( $totaldeleted );
348
  ?>
349
- <div id="cp-ddp-reviewlink" data-dismissible="ddp-leavereview-14" class="updated notice notice-success is-dismissible">
350
- <h3>
351
- <?php
352
  // translators: Total number of deleted duplicates
353
  printf( esc_html__( '%s duplicates deleted!', 'delete-duplicate-posts' ), esc_html( $totaldeleted ) );
354
  ?>
355
- </h3>
356
- <p>
357
- <?php
358
  // translators: Asking for a review text
359
  printf( esc_html__( "Hey, I noticed this plugin has deleted %s duplicate posts for you - that's awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation.", 'delete-duplicate-posts' ), esc_html( $totaldeleted ) );
360
  ?>
361
- </p>
362
 
363
- <p>
364
- <a href="https://wordpress.org/support/plugin/delete-duplicate-posts/reviews/?filter=5#new-post" class="cp-ddp-dismiss-review-notice cp-ddp-reviewlink button-primary dismiss-this" target="_blank" rel="noopener">Ok, you deserve it</a>
365
- <span class="dashicons dashicons-calendar"></span><a href="#" class="cp-ddp-dismiss-review-notice dismiss-this" target="_blank" rel="noopener">Nope, maybe later</a>
366
- <span class="dashicons dashicons-smiley"></span><a href="#" class="cp-ddp-dismiss-review-notice dismiss-this" target="_blank" rel="noopener">I already did</a>
367
- </p>
368
- </div>
369
- <?php
 
 
 
 
370
  }
371
 
372
  }
@@ -394,6 +408,13 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
394
  $checked_posts[] = intval( $cp );
395
  }
396
  }
 
 
 
 
 
 
 
397
  self::cleandupes( true, $checked_posts );
398
  wp_send_json_success();
399
  }
@@ -704,11 +725,20 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
704
  'ddp_resultslimit' => 0,
705
  'ddp_enabled' => 0,
706
  'ddp_pstati' => array( 'publish' ),
 
707
  );
708
  return $defaults;
709
  }
710
 
711
- // get plugin's options
 
 
 
 
 
 
 
 
712
  public static function get_options()
713
  {
714
  $options = get_option( self::$options_name, array() );
@@ -719,6 +749,16 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
719
  return $options;
720
  }
721
 
 
 
 
 
 
 
 
 
 
 
722
  public static function add_freemius_extra_permission( $permissions )
723
  {
724
  $permissions['helpscout'] = array(
@@ -739,7 +779,11 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
739
  /**
740
  * Fetch plugin version from plugin PHP header
741
  *
742
- * @return string Plugin version
 
 
 
 
743
  */
744
  public static function get_plugin_version()
745
  {
@@ -749,11 +793,32 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
749
  return $plugin_data['version'];
750
  }
751
 
 
 
 
 
 
 
 
 
 
 
752
  public static function timerstart( $watchname )
753
  {
754
  set_transient( 'ddp_' . $watchname, microtime( true ), 60 * 60 * 1 );
755
  }
756
 
 
 
 
 
 
 
 
 
 
 
 
757
  public static function timerstop( $watchname, $digits = 3 )
758
  {
759
  $return = round( microtime( true ) - get_transient( 'ddp_' . $watchname ), $digits );
@@ -763,6 +828,14 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
763
 
764
  /**
765
  * Clean duplicates - not AJAX version
 
 
 
 
 
 
 
 
766
  */
767
  public static function cleandupes( $manualrun = false, $to_delete = array() )
768
  {
@@ -816,13 +889,15 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
816
  update_option( 'ddp_deleted_duplicates', 1 );
817
  }
818
 
819
- self::log( sprintf(
820
- __( "Deleted %1\$s '%2\$s' (id: %3\$s) in %4\$s sec.", 'delete-duplicate-posts' ),
821
- $dupe['type'],
822
- $title,
823
- $postid,
824
- $timespent
825
- ) );
 
 
826
  }
827
 
828
  }
@@ -833,20 +908,24 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
833
  // translators: How many posts were deleted and how long it took in seconds
834
  self::log( sprintf( __( 'A total of %1$s duplicate posts were deleted in %2$s sec.', 'delete-duplicate-posts' ), $dispcount, $totaltimespent ) );
835
 
836
- if ( $manualrun > 0 ) {
837
  ?>
838
- <div class="notice notice-success">
839
- <p>
840
- <?php
841
  // translators:
842
  printf( esc_html__( 'A total of %s duplicate posts were deleted.', 'delete-duplicate-posts' ), intval( $dispcount ) );
843
  ?>
844
- </p>
845
- </div>
846
- <?php
 
 
 
 
 
847
  }
848
-
849
- // manualrun
850
  }
851
 
852
  // Mail logic...
@@ -877,6 +956,16 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
877
  self::save_options( $options );
878
  }
879
 
 
 
 
 
 
 
 
 
 
 
880
  public static function add_cron_intervals( $schedules )
881
  {
882
  $schedules['5min'] = array(
@@ -951,7 +1040,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
951
  );
952
  wp_register_script(
953
  'delete-duplicate-posts',
954
- plugins_url( '/js/delete-duplicate-posts.js', __FILE__ ),
955
  array( 'jquery' ),
956
  $pluginver,
957
  true
@@ -997,6 +1086,13 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
997
 
998
  /**
999
  * Install routines - create database and default options
 
 
 
 
 
 
 
1000
  */
1001
  public static function install( $network_wide )
1002
  {
@@ -1017,8 +1113,22 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1017
 
1018
  }
1019
 
1020
- // Creating table when a new blog is created
1021
- // https://sudarmuthu.com/blog/how-to-properly-create-tables-in-wordpress-multisite-plugins/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1022
  public static function on_create_blog(
1023
  $blog_id,
1024
  $user_id,
@@ -1037,7 +1147,16 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1037
 
1038
  }
1039
 
1040
- // Deleting the table whenever a blog is deleted
 
 
 
 
 
 
 
 
 
1041
  public static function on_delete_blog( $tables )
1042
  {
1043
  global $wpdb ;
@@ -1047,6 +1166,13 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1047
 
1048
  /**
1049
  * Saves options
 
 
 
 
 
 
 
1050
  */
1051
  public static function save_options( $newoptions )
1052
  {
@@ -1055,6 +1181,12 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1055
 
1056
  /**
1057
  * Adds link to menu under Tools
 
 
 
 
 
 
1058
  */
1059
  public static function admin_menu_link()
1060
  {
@@ -1073,6 +1205,17 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1073
  );
1074
  }
1075
 
 
 
 
 
 
 
 
 
 
 
 
1076
  public static function filter_plugin_actions( $links, $file )
1077
  {
1078
  $settings_link = '<a href="tools.php?page=delete-duplicate-posts">' . __( 'Settings', 'delete-duplicate-posts' ) . '</a>';
@@ -1083,6 +1226,12 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1083
 
1084
  /**
1085
  * Adds help content to plugin page
 
 
 
 
 
 
1086
  */
1087
  public static function set_custom_help_content()
1088
  {
@@ -1091,22 +1240,24 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1091
  $screen->add_help_tab( array(
1092
  'id' => 'ddp_help',
1093
  'title' => __( 'Usage and FAQ', 'delete-duplicate-posts' ),
1094
- 'content' => '
1095
- <h4>' . __( 'What does this plugin do?', 'delete-duplicate-posts' ) . '</h4>
1096
- <p>' . __( 'Helps you clean duplicate posts from your blog. The plugin checks for blogposts on your blog with the same title.', 'delete-duplicate-posts' ) . '</p>
1097
- <p>' . __( "It can run automatically via WordPress's own internal CRON-system, or you can run it automatically.", 'delete-duplicate-posts' ) . '</p>
1098
- <p>' . __( 'It also has a nice feature that can send you an e-mail when Delete Duplicate Posts finds and deletes something (if you have turned on the CRON feature).', 'delete-duplicate-posts' ) . '</p>
1099
- <h4>' . __( 'Help! Something was deleted that was not supposed to be deleted!', 'delete-duplicate-posts' ) . '</h4>
1100
- <p>' . __( 'I am sorry for that, I can only recommend you restore the database you took just before you ran this plugin.', 'delete-duplicate-posts' ) . '</p>
1101
- <p>' . __( 'If you run this plugin, manually or automatically, it is at your OWN risk!', 'delete-duplicate-posts' ) . '</p>
1102
- <p>' . __( 'I have done my best to avoid deleting something that should not be deleted, but if it happens, there is nothing I can do to help you.', 'delete-duplicate-posts' ) . "</p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p><a href='https://cleverplugins.com' target='_blank'>cleverplugins.com</a>.</p>",
1103
  ) );
1104
  }
1105
  }
1106
 
 
 
 
 
 
 
 
 
 
 
1107
  public static function admin_options_page()
1108
  {
1109
- global $ddp_fs ;
1110
  // DELETE NOW
1111
  if ( isset( $_POST['deleteduplicateposts_delete'] ) && isset( $_POST['_wpnonce'] ) ) {
1112
 
@@ -1146,6 +1297,7 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1146
  }
1147
 
1148
  $options['ddp_statusmail'] = ( isset( $_POST['ddp_statusmail'] ) && 'on' === $_POST['ddp_statusmail'] ? true : false );
 
1149
  if ( isset( $_POST['ddp_statusmail_recipient'] ) ) {
1150
  $options['ddp_statusmail_recipient'] = sanitize_text_field( $_POST['ddp_statusmail_recipient'] );
1151
  }
@@ -1190,7 +1342,6 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1190
  if ( !wp_verify_nonce( $_POST['_wpnonce'], 'ddp_clearlog_nonce' ) ) {
1191
  die( esc_html( __( 'Whoops! Some error occured, try again, please!', 'delete-duplicate-posts' ) ) );
1192
  }
1193
- global $wpdb ;
1194
  $table_name_log = $wpdb->prefix . 'ddp_log';
1195
  $wpdb->query( "TRUNCATE {$table_name_log};" );
1196
  //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
@@ -1207,7 +1358,6 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1207
  self::log( 'Reinstalled databases' );
1208
  }
1209
 
1210
- global $wpdb ;
1211
  $table_name = $wpdb->prefix . 'posts';
1212
  $pluginfo = get_plugin_data( __FILE__ );
1213
  $version = $pluginfo['Version'];
@@ -1215,17 +1365,17 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1215
  $options = self::get_options();
1216
  ?>
1217
 
1218
- <div class="wrap">
1219
 
1220
- <h2>Delete Duplicate Posts <span>v. <?php
1221
  echo esc_html( self::get_plugin_version() ) ;
1222
  ?></span></h2>
1223
 
1224
- <div class="ddp_content_wrapper">
1225
- <div class="ddp_content_cell">
1226
- <div id="ddp_container">
1227
- <div id="dashboard">
1228
- <?php
1229
 
1230
  if ( $options['ddp_enabled'] ) {
1231
  $interval = $options['ddp_schedule'];
@@ -1248,70 +1398,76 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1248
 
1249
  $totaldeleted = get_option( 'ddp_deleted_duplicates' );
1250
  ?>
1251
- <div class="statusdiv">
1252
- <div class="spinner is-active"></div>
1253
- <div class="statusmessage"></div>
1254
- <div class="dupelist">
1255
- <table class="wp-list-table widefat fixed striped posts duplicatetable" cellspacing="0">
1256
- <thead>
1257
- <tr>
1258
- <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox"></td>
1259
- <th><?php
 
1260
  esc_html_e( 'Duplicate', 'delete-duplicate-posts' );
1261
  ?></th>
1262
- <th><?php
1263
  esc_html_e( 'Original', 'delete-duplicate-posts' );
1264
  ?></th>
1265
- </tr>
1266
- </thead>
1267
- <tbody id="listofduplicates">
1268
- </tbody>
1269
 
1270
- <tfoot>
1271
- <tr>
1272
- <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox"></td>
1273
- <th><?php
 
1274
  esc_html_e( 'Duplicate', 'delete-duplicate-posts' );
1275
  ?></th>
1276
- <th><?php
1277
  esc_html_e( 'Original', 'delete-duplicate-posts' );
1278
  ?></th>
1279
- </tr>
1280
- </tfoot>
1281
- </table>
1282
- </div>
1283
- <form>
1284
- <?php
1285
  wp_nonce_field( 'ddp-buttons' );
1286
  ?>
1287
- <table id="ddp_buttons">
1288
- <tr>
1289
- <td><input type="submit" name="deleteduplicateposts_resetview" id="deleteduplicateposts_resetview" class="button button-small button-secondary" value="<?php
 
 
1290
  esc_html_e( 'Refresh list', 'delete-duplicate-posts' );
1291
  ?>" disabled /></td>
1292
- <td><input type="submit" name="deleteduplicateposts_deleteall" id="deleteduplicateposts_deleteall" class="button button-small button-primary" value="<?php
 
 
1293
  esc_html_e( 'Delete duplicates', 'delete-duplicate-posts' );
1294
  ?>" disabled /></td>
1295
- </tr>
1296
- </table>
1297
- </form>
1298
- </div>
1299
 
1300
- </div><!-- #dashboard -->
1301
 
1302
- <div id="configuration">
1303
- <h3><?php
1304
  esc_html_e( 'Settings', 'delete-duplicate-posts' );
1305
  ?></h3>
1306
- <p>
1307
- <?php
1308
  $nextscheduled = wp_next_scheduled( 'ddp_cron' );
1309
 
1310
  if ( $nextscheduled ) {
1311
  ?>
1312
- <div class="notice notice-info is-dismissible">
1313
- <h3><span class="dashicons dashicons-saved"></span> Automatically Deleting Duplicates</h3>
1314
- <?php
1315
  echo '<p class="cronstatus center">' . esc_html__( 'You have enabled automatic deletion, so I am running on automatic. I will take care of everything...', 'delete-duplicate-posts' ) . '</p>' ;
1316
  echo '<p class="center">' ;
1317
  echo sprintf(
@@ -1322,26 +1478,27 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1322
  ) ;
1323
  echo '</p>' ;
1324
  ?>
1325
- </div>
1326
- <?php
1327
  }
1328
 
1329
  ?>
1330
- </p>
1331
- <form method="post" id="delete_duplicate_posts_options">
1332
- <?php
1333
  wp_nonce_field( 'ddp-update-options' );
1334
  ?>
1335
- <table width="100%" cellspacing="2" cellpadding="5" class="form-table">
1336
 
1337
 
1338
- <tr valign="top">
1339
- <th><label for="ddp_enabled"><?php
 
1340
  esc_html_e( 'Which post types?:', 'delete-duplicate-posts' );
1341
  ?></label>
1342
- </th>
1343
- <td>
1344
- <?php
1345
  $builtin = array( 'post', 'page', 'attachment' );
1346
  $args = array(
1347
  'public' => true,
@@ -1355,8 +1512,8 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1355
 
1356
  if ( $post_types ) {
1357
  ?>
1358
- <ul class="radio">
1359
- <?php
1360
  $step = 0;
1361
  if ( !is_array( $checked_post_types ) ) {
1362
  $checked_post_types = array();
@@ -1364,22 +1521,22 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1364
  foreach ( $post_types as $pt ) {
1365
  $checked = array_search( $pt, $checked_post_types, true );
1366
  ?>
1367
- <li><input type="checkbox" name="ddp_pts[]" id="ddp_pt-<?php
1368
  echo esc_attr( $step ) ;
1369
- ?>" value="<?php
 
1370
  echo esc_html( $pt ) ;
1371
- ?>"
1372
- <?php
1373
  if ( false !== $checked ) {
1374
  echo ' checked' ;
1375
  }
1376
- ?>/>
1377
- <label for="ddp_pt-<?php
1378
  echo esc_attr( $step ) ;
1379
  ?>"><?php
1380
  echo esc_html( $pt ) ;
1381
  ?></label>
1382
- <?php
1383
  // Count for each post type
1384
  $postinfo = wp_count_posts( $pt );
1385
  $othercount = 0;
@@ -1388,31 +1545,32 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1388
  }
1389
  // translators: Total number of deleted duplicates
1390
  echo '<small>' . sprintf( esc_html__( '(%s total found)', 'delete-duplicate-posts' ), esc_html( number_format_i18n( $othercount ) ) ) . '</small>' ;
1391
- ?></li>
1392
- <?php
 
1393
  $step++;
1394
  }
1395
  ?>
1396
- </ul>
1397
- <?php
1398
  }
1399
 
1400
  ?>
1401
- <p class="description">
1402
- <?php
1403
  esc_html_e( 'Choose which post types to scan for duplicates.', 'delete-duplicate-posts' );
1404
  ?>
1405
- </p>
1406
- </td>
1407
- </tr>
1408
 
1409
- <tr>
1410
- <th><label for="ddp_enabled"><?php
1411
  esc_html_e( 'Post status', 'delete-duplicate-posts' );
1412
  ?></label>
1413
- </th>
1414
- <td>
1415
- <?php
1416
  $stati = array(
1417
  'publish' => (object) array(
1418
  'label' => 'Published',
@@ -1423,129 +1581,127 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1423
 
1424
  if ( $stati ) {
1425
  ?>
1426
- <ul class="radio">
1427
- <?php
1428
  $staticount = count( $stati );
1429
  foreach ( $stati as $key => $st ) {
1430
 
1431
  if ( $st->show_in_admin_status_list ) {
1432
  $checked = array_search( $key, $checked_post_stati, true );
1433
  ?>
1434
- <li>
1435
- <input type="checkbox" name="ddp_pstati[]" id="ddp_pstatus-<?php
1436
  echo esc_attr( $key ) ;
1437
- ?>" value="<?php
 
1438
  echo esc_attr( $key ) ;
1439
- ?>"
1440
- <?php
1441
  if ( false !== $checked ) {
1442
  echo ' checked' ;
1443
  }
1444
- ?>
1445
- <?php
1446
  if ( 1 === $staticount ) {
1447
  echo ' disabled' ;
1448
  }
1449
- ?>
1450
- />
1451
- <label for="ddp_pstatus-<?php
1452
  echo esc_attr( $key ) ;
1453
  ?>"><?php
1454
  echo esc_html( $key . ' (' . $st->label . ')' ) ;
1455
  ?></label>
1456
- </li>
1457
- <?php
1458
  $step++;
1459
  }
1460
 
1461
  }
1462
  ?>
1463
- </ul>
1464
- <?php
1465
  }
1466
 
1467
  ?>
1468
- </td>
1469
 
1470
 
1471
- </tr>
1472
- <?php
1473
  $comparemethod = 'titlecompare';
1474
  global $ddp_fs ;
1475
  ?>
1476
- <tr valign="top">
1477
- <th><?php
1478
  esc_html_e( 'Comparison Method', 'delete-duplicate-posts' );
1479
  ?></th>
1480
- <td>
1481
- <ul class="ddpcomparemethod">
1482
 
1483
- <li>
1484
- <label>
1485
- <input type="radio" name="ddp_method" value="titlecompare" <?php
 
1486
  checked( 'titlecompare', $comparemethod );
1487
  ?> />
1488
- <?php
1489
  esc_html_e( 'Compare by title (default)', 'delete-duplicate-posts' );
1490
  ?>
1491
- <span class="optiondesc"><?php
 
1492
  esc_html_e( 'Looks at the title of the post itself.', 'delete-duplicate-posts' );
1493
  ?></span>
1494
- </label>
1495
 
1496
- </li>
1497
 
1498
- <?php
1499
  global $ddp_fs ;
1500
  ?>
1501
- </ul>
1502
- </td>
1503
- </tr>
1504
- <tr>
1505
- <th><label for="ddp_keep"><?php
 
1506
  esc_html_e( 'Delete which posts?:', 'delete-duplicate-posts' );
1507
  ?></label></th>
1508
- <td>
1509
 
1510
- <select name="ddp_keep" id="ddp_keep">
1511
- <option value="oldest"
1512
- <?php
1513
  if ( 'oldest' === $options['ddp_keep'] ) {
1514
  echo 'selected="selected"' ;
1515
  }
1516
- ?>
1517
- ><?php
1518
  esc_html_e( 'Keep oldest', 'delete-duplicate-posts' );
1519
  ?></option>
1520
- <option value="latest"
1521
- <?php
1522
  if ( 'latest' === $options['ddp_keep'] ) {
1523
  echo 'selected="selected"' ;
1524
  }
1525
- ?>
1526
- ><?php
1527
  esc_html_e( 'Keep latest', 'delete-duplicate-posts' );
1528
  ?></option>
1529
- </select>
1530
- <p class="description">
1531
- <?php
1532
  esc_html_e( 'Keep the oldest or the latest version of duplicates? Default is keeping the oldest, and deleting any subsequent duplicate posts', 'delete-duplicate-posts' );
1533
  ?>
1534
- </p>
1535
- </td>
1536
- </tr>
1537
 
1538
 
1539
 
1540
 
1541
- <tr>
1542
- <th><label for="ddp_resultslimit"><?php
 
1543
  esc_html_e( 'Find how many duplicates:', 'delete-duplicate-posts' );
1544
  ?></label>
1545
- </th>
1546
- <td>
1547
 
1548
- <?php
1549
  $dupe_options = array(
1550
  0 => __( 'No limit', 'delete-duplicate-posts' ),
1551
  10000 => number_format_i18n( '10000' ),
@@ -1559,53 +1715,54 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1559
  10 => '10',
1560
  );
1561
  ?>
1562
- <select name="ddp_resultslimit" id="ddp_resultslimit">
1563
- <?php
1564
  foreach ( $dupe_options as $key => $label ) {
1565
  ?>
1566
- <option value="<?php
1567
  echo esc_attr( $key ) ;
1568
- ?>" <?php
 
1569
  selected( $options['ddp_resultslimit'], $key );
1570
  ?>>
1571
- <?php
1572
  echo esc_attr( $label ) ;
1573
  ?></option>
1574
- <?php
1575
  }
1576
  ?>
1577
- </select>
1578
 
1579
- <p class="description">
1580
- <?php
1581
  esc_html_e( 'If you have many duplicates, the plugin might time out before finding them all. Try limiting the amount of duplicates here. Default: Unlimited.', 'delete-duplicate-posts' );
1582
  ?>
1583
- </p>
1584
- </td>
1585
- </tr>
1586
 
1587
- <?php
1588
  /*
1589
 
1590
- <tr valign="top">
1591
- <th><label for="ddp_limit"><?php esc_html_e( 'Delete at maximum :', 'delete-duplicate-posts' ); ?></label>
1592
  </th>
1593
  <td><select name="ddp_limit">
1594
- <?php
1595
- for ( $x = 1; $x <= 10; $x++ ) {
1596
- $val = ( $x * 50 );
1597
- echo "<option value='" . esc_attr( $val ) . "' ";
1598
- if ( $options['ddp_limit'] === $val ) {
1599
- echo 'selected';
1600
- }
1601
- echo '>' . esc_attr( $val ) . '</option>';
1602
- }
1603
- ?>
1604
- </select>
1605
- <?php esc_html_e( 'duplicates.', 'delete-duplicate-posts' ); ?>
1606
- <p class="description">
1607
- <?php esc_html_e( 'Setting a limit is a good idea, especially if your site is on a busy server.', 'delete-duplicate-posts' ); ?>
1608
- </p>
1609
  </td>
1610
  </tr>
1611
  */
@@ -1613,169 +1770,181 @@ if ( !class_exists( 'Delete_Duplicate_Posts' ) ) {
1613
 
1614
 
1615
 
1616
- <tr>
1617
- <td colspan="2">
1618
- <hr>
1619
- </td>
1620
- </tr>
1621
 
1622
- <tr valign="top">
1623
- <th><?php
1624
  esc_html_e( 'Enable automatic deletion?:', 'delete-duplicate-posts' );
1625
  ?>
1626
 
1627
- </th>
1628
- <td><label for="ddp_enabled">
1629
- <input type="checkbox" id="ddp_enabled" name="ddp_enabled"
1630
- <?php
1631
  if ( true === $options['ddp_enabled'] ) {
1632
  echo 'checked="checked"' ;
1633
  }
1634
- ?>
1635
- >
1636
- <p class="description">
1637
- <?php
1638
  esc_html_e( 'Clean duplicates automatically.', 'delete-duplicate-posts' );
1639
  ?></p>
1640
- </label>
1641
- </td>
1642
- </tr>
1643
 
1644
 
1645
- <tr>
1646
- <th><label for="ddp_schedule"><?php
1647
  esc_html_e( 'How often?:', 'delete-duplicate-posts' );
1648
  ?></label>
1649
- </th>
1650
- <td>
1651
 
1652
- <select name="ddp_schedule" id="ddp_schedule">
1653
- <?php
1654
  $schedules = wp_get_schedules();
1655
  if ( $schedules ) {
1656
  foreach ( $schedules as $key => $sch ) {
1657
  ?>
1658
- <option value="<?php
1659
  echo esc_attr( $key ) ;
1660
- ?>"
1661
- <?php
1662
  if ( isset( $options['ddp_schedule'] ) && esc_attr( $key ) === $options['ddp_schedule'] ) {
1663
  echo esc_html( 'selected="selected"' ) ;
1664
  }
1665
- ?>
1666
- ><?php
1667
  echo esc_html( $sch['display'] ) ;
1668
  ?></option>
1669
- <?php
1670
  }
1671
  }
1672
  ?>
1673
- </select>
1674
- <p class="description">
1675
- <?php
1676
  esc_html_e( 'How often should the cron job run?', 'delete-duplicate-posts' );
1677
  ?></p>
1678
- </td>
1679
- </tr>
1680
 
1681
 
1682
 
1683
- <tr>
1684
- <td colspan="2">
1685
- <hr>
1686
- </td>
1687
- </tr>
1688
 
1689
- <tr>
1690
- <th><?php
1691
  esc_html_e( 'Send status mail?:', 'delete-duplicate-posts' );
1692
  ?></th>
1693
- <td>
1694
- <label for="ddp_statusmail">
1695
- <input type="checkbox" id="ddp_statusmail" name="ddp_statusmail"
1696
- <?php
1697
  if ( isset( $options['ddp_statusmail'] ) && true === $options['ddp_statusmail'] ) {
1698
  echo 'checked="checked"' ;
1699
  }
1700
- ?>
1701
- <p class="description"><?php
 
1702
  esc_html_e( 'Sends a status email if duplicates have been found.', 'delete-duplicate-posts' );
1703
  ?>
1704
- </p>
1705
- </label>
1706
- </td>
1707
- </tr>
1708
 
1709
- <tr>
1710
- <th><?php
1711
  esc_html_e( 'Email recipient:', 'delete-duplicate-posts' );
1712
  ?></th>
1713
- <td>
1714
- <label for="ddp_statusmail_recipient">
1715
 
1716
- <input type="text" class="regular-text" id="ddp_statusmail_recipient" name="ddp_statusmail_recipient" value="<?php
 
 
1717
  echo esc_html( $options['ddp_statusmail_recipient'] ) ;
1718
  ?>">
1719
- <p class="description">
1720
- <?php
1721
  esc_html_e( 'Who should get the notification email.', 'delete-duplicate-posts' );
1722
  ?></p>
1723
- </label>
1724
- </td>
1725
- </tr>
1726
 
1727
 
1728
 
 
 
 
 
 
1729
 
1730
- <th colspan=2><input type="submit" class="button-primary" name="delete_duplicate_posts_save" value="<?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1731
  esc_html_e( 'Save Settings', 'delete-duplicate-posts' );
1732
  ?>" /></th>
1733
- </tr>
1734
-
1735
- </table>
1736
-
1737
- </form>
1738
- </div><!-- #configuration -->
1739
-
1740
-
1741
- <div id="log">
1742
-
1743
- <h3><?php
1744
  esc_html_e( 'The Log', 'delete-duplicate-posts' );
1745
  ?></h3>
1746
- <div class="spinner is-active"></div>
1747
- <ul class="large-text" name="ddp_log" id="ddp_log">
1748
- </ul>
1749
-
1750
- </div>
1751
- <p>
1752
- <form method="post" id="ddp_clearlog">
1753
- <?php
1754
  wp_nonce_field( 'ddp_clearlog_nonce' );
1755
  ?>
1756
-
1757
- <input class="button-secondary" type="submit" name="ddp_clearlog" value="<?php
1758
  esc_html_e( 'Reset log', 'delete-duplicate-posts' );
1759
  ?>" />
1760
- </form>
1761
- </p>
1762
-
1763
- </div><!-- #ddp_container -->
1764
-
1765
- <?php
1766
  include_once 'sidebar.php';
1767
- ?>
1768
-
1769
- <?php
1770
  if ( function_exists( 'ddp_fs' ) ) {
1771
  global $ddp_fs ;
1772
  }
1773
  ?>
1774
 
1775
- </div>
1776
- </div>
1777
 
1778
- </div>
1779
  <?php
1780
  }
1781
 
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: 4.7.8
9
  Author: cleverplugins.com
10
  Author URI: https://cleverplugins.com
11
  Min WP Version: 4.7
244
  if ( PAnD::is_admin_notice_active( 'ddp-newsletter-14' ) && in_array( $screen->id, array( 'dashboard', 'tools_page_delete-duplicate-posts', 'plugins' ), true ) ) {
245
  $current_user = wp_get_current_user();
246
  ?>
247
+ <div id="cp-ddp-newsletter" data-dismissible="ddp-newsletter-14" class="updated notice notice-success is-dismissible">
248
+ <h3>Delete Duplicate Posts Newsletter</h3>
249
+ <h4>Please sign up for our newsletter to learn about changes and improvements to the plugin.</h4>
250
+ <form class="ml-block-form" action="https://static.mailerlite.com/webforms/submit/l2v7x5" data-code="l2v7x5"
251
+ method="post" target="_blank">
252
+ <table>
253
+ <tbody>
254
+ <tr>
255
+ <td>
256
+ <div class="ml-field-group ml-field-name">
257
+ <input type="text" class="regular-text" data-inputmask="" name="fields[name]" placeholder="Name"
258
+ autocomplete="name" style="width:15em;" value="<?php
259
  echo esc_html( $current_user->display_name ) ;
260
+ ?>"
261
+ required="required">
262
+ </div>
263
+ </td>
264
+ <td>
265
+ <div class="ml-field-group ml-field-email ml-validate-email ml-validate-required">
266
+ <input type="email" class="regular-text required email" data-inputmask="" name="fields[email]"
267
+ placeholder="Email" autocomplete="email" value="<?php
268
  echo esc_html( $current_user->user_email ) ;
269
+ ?>"
270
+ required="required">
271
+ </div>
272
+ </td>
273
+ <td>
274
+ <button type="submit" class="button">Subscribe</button>
275
+ </td>
276
+ </tr>
277
+ <tr>
278
+ <td colspan="3">
279
+ <div class="privacy-policy">
280
+ <p>You can unsubscribe anytime. For more details, review our <a
281
+ href="https://cleverplugins.com/privacy-policy/" target="_blank">Privacy Policy</a>.</p>
282
+ </div>
283
+ </td>
284
+ </tr>
285
+ </table>
286
+ </table>
287
+ <input type="hidden" name="fields[signupsource]"
288
+ value="DDP Plugin <?php
289
  echo esc_attr( self::get_plugin_version() ) ;
290
  ?>">
291
+ <input type="hidden" name="ml-submit" value="1">
292
+ <input type="hidden" name="anticsrf" value="true">
293
+ </form>
294
+ <p><small>Signup form is shown every 14 days until dismissed</small></p>
295
+ </div>
296
+ <?php
297
  }
298
 
299
  if ( 'tools_page_delete-duplicate-posts' !== $screen->id ) {
307
 
308
  if ( PAnD::is_admin_notice_active( 'cp-ddp-improve-notice-7' ) ) {
309
  ?>
310
+ <div id="cp-ddp-freemius" data-dismissible="cp-ddp-improve-notice-7" class="notice notice-success is-dismissible">
311
+ <h3><?php
312
  esc_html_e( 'Help Delete Duplicate Posts improve!', 'delete-duplicate-posts' );
313
  ?></h3>
314
 
315
+ <p>
316
+ <?php
317
  echo esc_html__( 'Gathering non-sensitive diagnostic data about the plugin install helps us improve the plugin.', 'delete-duplicate-posts' ) . ' <a href="' . esc_url( 'https://cleverplugins.com/docs/install/non-sensitive-diagnostic-data/' ) . '" target="_blank" rel="noopener">' . esc_html__( 'Read more about what we collect.', 'delete-duplicate-posts' ) . '</a>' ;
318
  ?>
319
+ </p>
320
 
321
+ <p>
322
+ <?php
323
  // translators:
324
  printf( esc_html__( 'If you opt-in, some data about your usage of %1$s will be sent to Freemius.com. If you skip this, that\'s okay! %1$s will still work just fine.', 'delete-duplicate-posts' ), '<b>Delete Duplicate Posts</b>' );
325
  ?>
326
+ </p>
327
+ <p>
328
+ <a href="javascript:;" class="button button-primary" onclick="cp_ddp_freemius_opt_in(this)"
329
+ data-opt="yes"><?php
330
  esc_html_e( 'Sure, opt-in', 'delete-duplicate-posts' );
331
  ?></a>
332
 
333
+ <a href="javascript:;"
334
+ class="button dismiss-this"><?php
335
  esc_html_e( 'No, thank you', 'delete-duplicate-posts' );
336
  ?></a>
337
+ </p>
338
+ <input type="hidden" id="cp-ddp-freemius-opt-nonce"
339
+ value="<?php
340
  echo esc_attr( wp_create_nonce( 'cp-ddp-freemius-opt' ) ) ;
341
  ?>" />
342
 
343
+ </div>
344
+ <?php
345
  }
346
 
347
  }
356
  if ( false !== $totaldeleted && 0 < $totaldeleted ) {
357
  $totaldeleted = number_format_i18n( $totaldeleted );
358
  ?>
359
+ <div id="cp-ddp-reviewlink" data-dismissible="ddp-leavereview-14" class="updated notice notice-success is-dismissible">
360
+ <h3>
361
+ <?php
362
  // translators: Total number of deleted duplicates
363
  printf( esc_html__( '%s duplicates deleted!', 'delete-duplicate-posts' ), esc_html( $totaldeleted ) );
364
  ?>
365
+ </h3>
366
+ <p>
367
+ <?php
368
  // translators: Asking for a review text
369
  printf( esc_html__( "Hey, I noticed this plugin has deleted %s duplicate posts for you - that's awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation.", 'delete-duplicate-posts' ), esc_html( $totaldeleted ) );
370
  ?>
371
+ </p>
372
 
373
+ <p>
374
+ <a href="https://wordpress.org/support/plugin/delete-duplicate-posts/reviews/?filter=5#new-post"
375
+ class="cp-ddp-dismiss-review-notice cp-ddp-reviewlink button-primary dismiss-this" target="_blank"
376
+ rel="noopener">Ok, you deserve it</a>
377
+ <span class="dashicons dashicons-calendar"></span><a href="#" class="cp-ddp-dismiss-review-notice dismiss-this"
378
+ target="_blank" rel="noopener">Nope, maybe later</a>
379
+ <span class="dashicons dashicons-smiley"></span><a href="#" class="cp-ddp-dismiss-review-notice dismiss-this"
380
+ target="_blank" rel="noopener">I already did</a>
381
+ </p>
382
+ </div>
383
+ <?php
384
  }
385
 
386
  }
408
  $checked_posts[] = intval( $cp );
409
  }
410
  }
411
+ $options = self::get_options();
412
+
413
+ if ( $options['ddp_debug'] ) {
414
+ $outputlist = array_values( array_slice( $checked_posts, 0, 10 ) );
415
+ self::log( 'DEBUG: Cleaning post IDs ' . print_r( $outputlist, true ) . ' (first 10 shown)' );
416
+ }
417
+
418
  self::cleandupes( true, $checked_posts );
419
  wp_send_json_success();
420
  }
725
  'ddp_resultslimit' => 0,
726
  'ddp_enabled' => 0,
727
  'ddp_pstati' => array( 'publish' ),
728
+ 'ddp_debug' => 0,
729
  );
730
  return $defaults;
731
  }
732
 
733
+ /**
734
+ * get plugin's options
735
+ *
736
+ * @author Lars Koudal
737
+ * @since v0.0.1
738
+ * @version v1.0.0 Thursday, June 9th, 2022.
739
+ * @access public static
740
+ * @return mixed
741
+ */
742
  public static function get_options()
743
  {
744
  $options = get_option( self::$options_name, array() );
749
  return $options;
750
  }
751
 
752
+ /**
753
+ * add_freemius_extra_permission.
754
+ *
755
+ * @author Lars Koudal
756
+ * @since v0.0.1
757
+ * @version v1.0.0 Thursday, June 9th, 2022.
758
+ * @access public static
759
+ * @param mixed $permissions
760
+ * @return mixed
761
+ */
762
  public static function add_freemius_extra_permission( $permissions )
763
  {
764
  $permissions['helpscout'] = array(
779
  /**
780
  * Fetch plugin version from plugin PHP header
781
  *
782
+ * @author Lars Koudal
783
+ * @since v0.0.1
784
+ * @version v1.0.0 Thursday, June 9th, 2022.
785
+ * @access public static
786
+ * @return mixed
787
  */
788
  public static function get_plugin_version()
789
  {
793
  return $plugin_data['version'];
794
  }
795
 
796
+ /**
797
+ * timerstart.
798
+ *
799
+ * @author Lars Koudal
800
+ * @since v0.0.1
801
+ * @version v1.0.0 Thursday, June 9th, 2022.
802
+ * @access public static
803
+ * @param mixed $watchname
804
+ * @return void
805
+ */
806
  public static function timerstart( $watchname )
807
  {
808
  set_transient( 'ddp_' . $watchname, microtime( true ), 60 * 60 * 1 );
809
  }
810
 
811
+ /**
812
+ * timerstop.
813
+ *
814
+ * @author Lars Koudal
815
+ * @since v0.0.1
816
+ * @version v1.0.0 Thursday, June 9th, 2022.
817
+ * @access public static
818
+ * @param mixed $watchname
819
+ * @param integer $digits Default: 3
820
+ * @return mixed
821
+ */
822
  public static function timerstop( $watchname, $digits = 3 )
823
  {
824
  $return = round( microtime( true ) - get_transient( 'ddp_' . $watchname ), $digits );
828
 
829
  /**
830
  * Clean duplicates - not AJAX version
831
+ *
832
+ * @author Lars Koudal
833
+ * @since v0.0.1
834
+ * @version v1.0.0 Thursday, June 9th, 2022.
835
+ * @access public static
836
+ * @param boolean $manualrun Default: false
837
+ * @param mixed $to_delete Default: array()
838
+ * @return void
839
  */
840
  public static function cleandupes( $manualrun = false, $to_delete = array() )
841
  {
889
  update_option( 'ddp_deleted_duplicates', 1 );
890
  }
891
 
892
+ if ( $options['ddp_debug'] ) {
893
+ self::log( sprintf(
894
+ __( "DEBUG: Deleted %1\$s '%2\$s' (id: %3\$s) in %4\$s sec.", 'delete-duplicate-posts' ),
895
+ $dupe['type'],
896
+ $title,
897
+ $postid,
898
+ $timespent
899
+ ) );
900
+ }
901
  }
902
 
903
  }
908
  // translators: How many posts were deleted and how long it took in seconds
909
  self::log( sprintf( __( 'A total of %1$s duplicate posts were deleted in %2$s sec.', 'delete-duplicate-posts' ), $dispcount, $totaltimespent ) );
910
 
911
+ if ( $manualrun > 0 && !wp_doing_ajax() ) {
912
  ?>
913
+ <div class="notice notice-success">
914
+ <p>
915
+ <?php
916
  // translators:
917
  printf( esc_html__( 'A total of %s duplicate posts were deleted.', 'delete-duplicate-posts' ), intval( $dispcount ) );
918
  ?>
919
+ </p>
920
+ </div>
921
+ <?php
922
+ } else {
923
+ $json_response = array(
924
+ 'msg' => sprintf( esc_html__( 'A total of %s duplicate posts were deleted.', 'delete-duplicate-posts' ), intval( $dispcount ) ),
925
+ );
926
+ wp_send_json_success( $json_response );
927
  }
928
+
 
929
  }
930
 
931
  // Mail logic...
956
  self::save_options( $options );
957
  }
958
 
959
+ /**
960
+ * add_cron_intervals.
961
+ *
962
+ * @author Lars Koudal
963
+ * @since v0.0.1
964
+ * @version v1.0.0 Thursday, June 9th, 2022.
965
+ * @access public static
966
+ * @param mixed $schedules
967
+ * @return mixed
968
+ */
969
  public static function add_cron_intervals( $schedules )
970
  {
971
  $schedules['5min'] = array(
1040
  );
1041
  wp_register_script(
1042
  'delete-duplicate-posts',
1043
+ plugins_url( '/js/delete-duplicate-posts-min.js', __FILE__ ),
1044
  array( 'jquery' ),
1045
  $pluginver,
1046
  true
1086
 
1087
  /**
1088
  * Install routines - create database and default options
1089
+ *
1090
+ * @author Lars Koudal
1091
+ * @since v0.0.1
1092
+ * @version v1.0.0 Thursday, June 9th, 2022.
1093
+ * @access public static
1094
+ * @param mixed $network_wide
1095
+ * @return void
1096
  */
1097
  public static function install( $network_wide )
1098
  {
1113
 
1114
  }
1115
 
1116
+ /**
1117
+ * Creating table when a new blog is created
1118
+ * https://sudarmuthu.com/blog/how-to-properly-create-tables-in-wordpress-multisite-plugins/
1119
+ *
1120
+ * @author Lars Koudal
1121
+ * @since v0.0.1
1122
+ * @version v1.0.0 Thursday, June 9th, 2022.
1123
+ * @access public static
1124
+ * @param mixed $blog_id
1125
+ * @param mixed $user_id
1126
+ * @param mixed $domain
1127
+ * @param mixed $path
1128
+ * @param mixed $site_id
1129
+ * @param mixed $meta
1130
+ * @return void
1131
+ */
1132
  public static function on_create_blog(
1133
  $blog_id,
1134
  $user_id,
1147
 
1148
  }
1149
 
1150
+ /**
1151
+ * Deleting the table whenever a blog is deleted
1152
+ *
1153
+ * @author Lars Koudal
1154
+ * @since v0.0.1
1155
+ * @version v1.0.0 Thursday, June 9th, 2022.
1156
+ * @access public static
1157
+ * @param mixed $tables
1158
+ * @return mixed
1159
+ */
1160
  public static function on_delete_blog( $tables )
1161
  {
1162
  global $wpdb ;
1166
 
1167
  /**
1168
  * Saves options
1169
+ *
1170
+ * @author Lars Koudal
1171
+ * @since v0.0.1
1172
+ * @version v1.0.0 Thursday, June 9th, 2022.
1173
+ * @access public static
1174
+ * @param mixed $newoptions
1175
+ * @return mixed
1176
  */
1177
  public static function save_options( $newoptions )
1178
  {
1181
 
1182
  /**
1183
  * Adds link to menu under Tools
1184
+ *
1185
+ * @author Lars Koudal
1186
+ * @since v0.0.1
1187
+ * @version v1.0.0 Thursday, June 9th, 2022.
1188
+ * @access public static
1189
+ * @return void
1190
  */
1191
  public static function admin_menu_link()
1192
  {
1205
  );
1206
  }
1207
 
1208
+ /**
1209
+ * filter_plugin_actions.
1210
+ *
1211
+ * @author Lars Koudal
1212
+ * @since v0.0.1
1213
+ * @version v1.0.0 Thursday, June 9th, 2022.
1214
+ * @access public static
1215
+ * @param mixed $links
1216
+ * @param mixed $file
1217
+ * @return mixed
1218
+ */
1219
  public static function filter_plugin_actions( $links, $file )
1220
  {
1221
  $settings_link = '<a href="tools.php?page=delete-duplicate-posts">' . __( 'Settings', 'delete-duplicate-posts' ) . '</a>';
1226
 
1227
  /**
1228
  * Adds help content to plugin page
1229
+ *
1230
+ * @author Lars Koudal
1231
+ * @since v0.0.1
1232
+ * @version v1.0.0 Thursday, June 9th, 2022.
1233
+ * @access public static
1234
+ * @return void
1235
  */
1236
  public static function set_custom_help_content()
1237
  {
1240
  $screen->add_help_tab( array(
1241
  'id' => 'ddp_help',
1242
  'title' => __( 'Usage and FAQ', 'delete-duplicate-posts' ),
1243
+ 'content' => '<h4>' . __( 'What does this plugin do?', 'delete-duplicate-posts' ) . '</h4><p>' . __( 'Helps you clean duplicate posts from your blog. The plugin checks for blogposts on your blog with the same title.', 'delete-duplicate-posts' ) . '</p><p>' . __( "It can run automatically via WordPress's own internal CRON-system, or you can run it automatically.", 'delete-duplicate-posts' ) . '</p><p>' . __( 'It also has a nice feature that can send you an e-mail when Delete Duplicate Posts finds and deletes something (if you have turned on the CRON feature).', 'delete-duplicate-posts' ) . '</p><h4>' . __( 'Help! Something was deleted that was not supposed to be deleted!', 'delete-duplicate-posts' ) . '</h4><p>' . __( 'I am sorry for that, I can only recommend you restore the database you took just before you ran this plugin.', 'delete-duplicate-posts' ) . '</p><p>' . __( 'If you run this plugin, manually or automatically, it is at your OWN risk!', 'delete-duplicate-posts' ) . '</p><p>' . __( 'I have done my best to avoid deleting something that should not be deleted, but if it happens, there is nothing I can do to help you.', 'delete-duplicate-posts' ) . "</p><p><a href='https://cleverplugins.com' target='_blank'>cleverplugins.com</a>.</p>",
 
 
 
 
 
 
 
 
1244
  ) );
1245
  }
1246
  }
1247
 
1248
+ /**
1249
+ * admin_options_page.
1250
+ *
1251
+ * @author Lars Koudal
1252
+ * @since v0.0.1
1253
+ * @version v1.0.0 Thursday, June 9th, 2022.
1254
+ * @version v1.0.1 Thursday, June 9th, 2022.
1255
+ * @access public static
1256
+ * @return void
1257
+ */
1258
  public static function admin_options_page()
1259
  {
1260
+ global $ddp_fs, $wpdb ;
1261
  // DELETE NOW
1262
  if ( isset( $_POST['deleteduplicateposts_delete'] ) && isset( $_POST['_wpnonce'] ) ) {
1263
 
1297
  }
1298
 
1299
  $options['ddp_statusmail'] = ( isset( $_POST['ddp_statusmail'] ) && 'on' === $_POST['ddp_statusmail'] ? true : false );
1300
+ $options['ddp_debug'] = ( isset( $_POST['ddp_debug'] ) && 'on' === $_POST['ddp_debug'] ? true : false );
1301
  if ( isset( $_POST['ddp_statusmail_recipient'] ) ) {
1302
  $options['ddp_statusmail_recipient'] = sanitize_text_field( $_POST['ddp_statusmail_recipient'] );
1303
  }
1342
  if ( !wp_verify_nonce( $_POST['_wpnonce'], 'ddp_clearlog_nonce' ) ) {
1343
  die( esc_html( __( 'Whoops! Some error occured, try again, please!', 'delete-duplicate-posts' ) ) );
1344
  }
 
1345
  $table_name_log = $wpdb->prefix . 'ddp_log';
1346
  $wpdb->query( "TRUNCATE {$table_name_log};" );
1347
  //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
1358
  self::log( 'Reinstalled databases' );
1359
  }
1360
 
 
1361
  $table_name = $wpdb->prefix . 'posts';
1362
  $pluginfo = get_plugin_data( __FILE__ );
1363
  $version = $pluginfo['Version'];
1365
  $options = self::get_options();
1366
  ?>
1367
 
1368
+ <div class="wrap">
1369
 
1370
+ <h2>Delete Duplicate Posts <span>v. <?php
1371
  echo esc_html( self::get_plugin_version() ) ;
1372
  ?></span></h2>
1373
 
1374
+ <div class="ddp_content_wrapper">
1375
+ <div class="ddp_content_cell">
1376
+ <div id="ddp_container">
1377
+ <div id="dashboard">
1378
+ <?php
1379
 
1380
  if ( $options['ddp_enabled'] ) {
1381
  $interval = $options['ddp_schedule'];
1398
 
1399
  $totaldeleted = get_option( 'ddp_deleted_duplicates' );
1400
  ?>
1401
+ <div class="statusdiv">
1402
+ <div class="spinner is-active"></div>
1403
+ <div class="statusmessage"></div>
1404
+ <div class="dupelist">
1405
+ <table class="wp-list-table widefat fixed striped posts duplicatetable" cellspacing="0">
1406
+ <thead>
1407
+ <tr>
1408
+ <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text"
1409
+ for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox"></td>
1410
+ <th><?php
1411
  esc_html_e( 'Duplicate', 'delete-duplicate-posts' );
1412
  ?></th>
1413
+ <th><?php
1414
  esc_html_e( 'Original', 'delete-duplicate-posts' );
1415
  ?></th>
1416
+ </tr>
1417
+ </thead>
1418
+ <tbody id="listofduplicates">
1419
+ </tbody>
1420
 
1421
+ <tfoot>
1422
+ <tr>
1423
+ <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text"
1424
+ for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox"></td>
1425
+ <th><?php
1426
  esc_html_e( 'Duplicate', 'delete-duplicate-posts' );
1427
  ?></th>
1428
+ <th><?php
1429
  esc_html_e( 'Original', 'delete-duplicate-posts' );
1430
  ?></th>
1431
+ </tr>
1432
+ </tfoot>
1433
+ </table>
1434
+ </div>
1435
+ <form>
1436
+ <?php
1437
  wp_nonce_field( 'ddp-buttons' );
1438
  ?>
1439
+ <table id="ddp_buttons">
1440
+ <tr>
1441
+ <td><input type="submit" name="deleteduplicateposts_resetview" id="deleteduplicateposts_resetview"
1442
+ class="button button-small button-secondary"
1443
+ value="<?php
1444
  esc_html_e( 'Refresh list', 'delete-duplicate-posts' );
1445
  ?>" disabled /></td>
1446
+ <td><input type="submit" name="deleteduplicateposts_deleteall" id="deleteduplicateposts_deleteall"
1447
+ class="button button-small button-primary"
1448
+ value="<?php
1449
  esc_html_e( 'Delete duplicates', 'delete-duplicate-posts' );
1450
  ?>" disabled /></td>
1451
+ </tr>
1452
+ </table>
1453
+ </form>
1454
+ </div>
1455
 
1456
+ </div><!-- #dashboard -->
1457
 
1458
+ <div id="configuration">
1459
+ <h3><?php
1460
  esc_html_e( 'Settings', 'delete-duplicate-posts' );
1461
  ?></h3>
1462
+ <p>
1463
+ <?php
1464
  $nextscheduled = wp_next_scheduled( 'ddp_cron' );
1465
 
1466
  if ( $nextscheduled ) {
1467
  ?>
1468
+ <div class="notice notice-info is-dismissible">
1469
+ <h3><span class="dashicons dashicons-saved"></span> Automatically Deleting Duplicates</h3>
1470
+ <?php
1471
  echo '<p class="cronstatus center">' . esc_html__( 'You have enabled automatic deletion, so I am running on automatic. I will take care of everything...', 'delete-duplicate-posts' ) . '</p>' ;
1472
  echo '<p class="center">' ;
1473
  echo sprintf(
1478
  ) ;
1479
  echo '</p>' ;
1480
  ?>
1481
+ </div>
1482
+ <?php
1483
  }
1484
 
1485
  ?>
1486
+ </p>
1487
+ <form method="post" id="delete_duplicate_posts_options">
1488
+ <?php
1489
  wp_nonce_field( 'ddp-update-options' );
1490
  ?>
1491
+ <table width="100%" cellspacing="2" cellpadding="5" class="form-table">
1492
 
1493
 
1494
+ <tr valign="top">
1495
+ <th><label
1496
+ for="ddp_enabled"><?php
1497
  esc_html_e( 'Which post types?:', 'delete-duplicate-posts' );
1498
  ?></label>
1499
+ </th>
1500
+ <td>
1501
+ <?php
1502
  $builtin = array( 'post', 'page', 'attachment' );
1503
  $args = array(
1504
  'public' => true,
1512
 
1513
  if ( $post_types ) {
1514
  ?>
1515
+ <ul class="radio">
1516
+ <?php
1517
  $step = 0;
1518
  if ( !is_array( $checked_post_types ) ) {
1519
  $checked_post_types = array();
1521
  foreach ( $post_types as $pt ) {
1522
  $checked = array_search( $pt, $checked_post_types, true );
1523
  ?>
1524
+ <li><input type="checkbox" name="ddp_pts[]" id="ddp_pt-<?php
1525
  echo esc_attr( $step ) ;
1526
+ ?>"
1527
+ value="<?php
1528
  echo esc_html( $pt ) ;
1529
+ ?>" <?php
 
1530
  if ( false !== $checked ) {
1531
  echo ' checked' ;
1532
  }
1533
+ ?> />
1534
+ <label for="ddp_pt-<?php
1535
  echo esc_attr( $step ) ;
1536
  ?>"><?php
1537
  echo esc_html( $pt ) ;
1538
  ?></label>
1539
+ <?php
1540
  // Count for each post type
1541
  $postinfo = wp_count_posts( $pt );
1542
  $othercount = 0;
1545
  }
1546
  // translators: Total number of deleted duplicates
1547
  echo '<small>' . sprintf( esc_html__( '(%s total found)', 'delete-duplicate-posts' ), esc_html( number_format_i18n( $othercount ) ) ) . '</small>' ;
1548
+ ?>
1549
+ </li>
1550
+ <?php
1551
  $step++;
1552
  }
1553
  ?>
1554
+ </ul>
1555
+ <?php
1556
  }
1557
 
1558
  ?>
1559
+ <p class="description">
1560
+ <?php
1561
  esc_html_e( 'Choose which post types to scan for duplicates.', 'delete-duplicate-posts' );
1562
  ?>
1563
+ </p>
1564
+ </td>
1565
+ </tr>
1566
 
1567
+ <tr>
1568
+ <th><label for="ddp_enabled"><?php
1569
  esc_html_e( 'Post status', 'delete-duplicate-posts' );
1570
  ?></label>
1571
+ </th>
1572
+ <td>
1573
+ <?php
1574
  $stati = array(
1575
  'publish' => (object) array(
1576
  'label' => 'Published',
1581
 
1582
  if ( $stati ) {
1583
  ?>
1584
+ <ul class="radio">
1585
+ <?php
1586
  $staticount = count( $stati );
1587
  foreach ( $stati as $key => $st ) {
1588
 
1589
  if ( $st->show_in_admin_status_list ) {
1590
  $checked = array_search( $key, $checked_post_stati, true );
1591
  ?>
1592
+ <li>
1593
+ <input type="checkbox" name="ddp_pstati[]" id="ddp_pstatus-<?php
1594
  echo esc_attr( $key ) ;
1595
+ ?>"
1596
+ value="<?php
1597
  echo esc_attr( $key ) ;
1598
+ ?>"<?php
 
1599
  if ( false !== $checked ) {
1600
  echo ' checked' ;
1601
  }
 
 
1602
  if ( 1 === $staticount ) {
1603
  echo ' disabled' ;
1604
  }
1605
+ ?> />
1606
+ <label
1607
+ for="ddp_pstatus-<?php
1608
  echo esc_attr( $key ) ;
1609
  ?>"><?php
1610
  echo esc_html( $key . ' (' . $st->label . ')' ) ;
1611
  ?></label>
1612
+ </li>
1613
+ <?php
1614
  $step++;
1615
  }
1616
 
1617
  }
1618
  ?>
1619
+ </ul>
1620
+ <?php
1621
  }
1622
 
1623
  ?>
1624
+ </td>
1625
 
1626
 
1627
+ </tr>
1628
+ <?php
1629
  $comparemethod = 'titlecompare';
1630
  global $ddp_fs ;
1631
  ?>
1632
+ <tr valign="top">
1633
+ <th><?php
1634
  esc_html_e( 'Comparison Method', 'delete-duplicate-posts' );
1635
  ?></th>
1636
+ <td>
1637
+ <ul class="ddpcomparemethod">
1638
 
1639
+ <li>
1640
+ <label>
1641
+ <input type="radio" name="ddp_method" value="titlecompare"
1642
+ <?php
1643
  checked( 'titlecompare', $comparemethod );
1644
  ?> />
1645
+ <?php
1646
  esc_html_e( 'Compare by title (default)', 'delete-duplicate-posts' );
1647
  ?>
1648
+ <span
1649
+ class="optiondesc"><?php
1650
  esc_html_e( 'Looks at the title of the post itself.', 'delete-duplicate-posts' );
1651
  ?></span>
1652
+ </label>
1653
 
1654
+ </li>
1655
 
1656
+ <?php
1657
  global $ddp_fs ;
1658
  ?>
1659
+ </ul>
1660
+ </td>
1661
+ </tr>
1662
+ <tr>
1663
+ <th><label
1664
+ for="ddp_keep"><?php
1665
  esc_html_e( 'Delete which posts?:', 'delete-duplicate-posts' );
1666
  ?></label></th>
1667
+ <td>
1668
 
1669
+ <select name="ddp_keep" id="ddp_keep">
1670
+ <option value="oldest" <?php
 
1671
  if ( 'oldest' === $options['ddp_keep'] ) {
1672
  echo 'selected="selected"' ;
1673
  }
1674
+ ?>><?php
 
1675
  esc_html_e( 'Keep oldest', 'delete-duplicate-posts' );
1676
  ?></option>
1677
+ <option value="latest" <?php
 
1678
  if ( 'latest' === $options['ddp_keep'] ) {
1679
  echo 'selected="selected"' ;
1680
  }
1681
+ ?>><?php
 
1682
  esc_html_e( 'Keep latest', 'delete-duplicate-posts' );
1683
  ?></option>
1684
+ </select>
1685
+ <p class="description">
1686
+ <?php
1687
  esc_html_e( 'Keep the oldest or the latest version of duplicates? Default is keeping the oldest, and deleting any subsequent duplicate posts', 'delete-duplicate-posts' );
1688
  ?>
1689
+ </p>
1690
+ </td>
1691
+ </tr>
1692
 
1693
 
1694
 
1695
 
1696
+ <tr>
1697
+ <th><label
1698
+ for="ddp_resultslimit"><?php
1699
  esc_html_e( 'Find how many duplicates:', 'delete-duplicate-posts' );
1700
  ?></label>
1701
+ </th>
1702
+ <td>
1703
 
1704
+ <?php
1705
  $dupe_options = array(
1706
  0 => __( 'No limit', 'delete-duplicate-posts' ),
1707
  10000 => number_format_i18n( '10000' ),
1715
  10 => '10',
1716
  );
1717
  ?>
1718
+ <select name="ddp_resultslimit" id="ddp_resultslimit">
1719
+ <?php
1720
  foreach ( $dupe_options as $key => $label ) {
1721
  ?>
1722
+ <option value="<?php
1723
  echo esc_attr( $key ) ;
1724
+ ?>"
1725
+ <?php
1726
  selected( $options['ddp_resultslimit'], $key );
1727
  ?>>
1728
+ <?php
1729
  echo esc_attr( $label ) ;
1730
  ?></option>
1731
+ <?php
1732
  }
1733
  ?>
1734
+ </select>
1735
 
1736
+ <p class="description">
1737
+ <?php
1738
  esc_html_e( 'If you have many duplicates, the plugin might time out before finding them all. Try limiting the amount of duplicates here. Default: Unlimited.', 'delete-duplicate-posts' );
1739
  ?>
1740
+ </p>
1741
+ </td>
1742
+ </tr>
1743
 
1744
+ <?php
1745
  /*
1746
 
1747
+ <tr valign="top">
1748
+ <th><label for="ddp_limit"><?php esc_html_e( 'Delete at maximum :', 'delete-duplicate-posts' ); ?></label>
1749
  </th>
1750
  <td><select name="ddp_limit">
1751
+ <?php
1752
+ for ( $x = 1; $x <= 10; $x++ ) {
1753
+ $val = ( $x * 50 );
1754
+ echo "<option value='" . esc_attr( $val ) . "' ";
1755
+ if ( $options['ddp_limit'] === $val ) {
1756
+ echo 'selected';
1757
+ }
1758
+ echo '>' . esc_attr( $val ) . '</option>';
1759
+ }
1760
+ ?>
1761
+ </select>
1762
+ <?php esc_html_e( 'duplicates.', 'delete-duplicate-posts' ); ?>
1763
+ <p class="description">
1764
+ <?php esc_html_e( 'Setting a limit is a good idea, especially if your site is on a busy server.', 'delete-duplicate-posts' ); ?>
1765
+ </p>
1766
  </td>
1767
  </tr>
1768
  */
1770
 
1771
 
1772
 
1773
+ <tr>
1774
+ <td colspan="2">
1775
+ <hr>
1776
+ </td>
1777
+ </tr>
1778
 
1779
+ <tr valign="top">
1780
+ <th><?php
1781
  esc_html_e( 'Enable automatic deletion?:', 'delete-duplicate-posts' );
1782
  ?>
1783
 
1784
+ </th>
1785
+ <td><label for="ddp_enabled">
1786
+ <input type="checkbox" id="ddp_enabled" name="ddp_enabled" <?php
 
1787
  if ( true === $options['ddp_enabled'] ) {
1788
  echo 'checked="checked"' ;
1789
  }
1790
+ ?>>
1791
+ <p class="description">
1792
+ <?php
 
1793
  esc_html_e( 'Clean duplicates automatically.', 'delete-duplicate-posts' );
1794
  ?></p>
1795
+ </label>
1796
+ </td>
1797
+ </tr>
1798
 
1799
 
1800
+ <tr>
1801
+ <th><label for="ddp_schedule"><?php
1802
  esc_html_e( 'How often?:', 'delete-duplicate-posts' );
1803
  ?></label>
1804
+ </th>
1805
+ <td>
1806
 
1807
+ <select name="ddp_schedule" id="ddp_schedule">
1808
+ <?php
1809
  $schedules = wp_get_schedules();
1810
  if ( $schedules ) {
1811
  foreach ( $schedules as $key => $sch ) {
1812
  ?>
1813
+ <option value="<?php
1814
  echo esc_attr( $key ) ;
1815
+ ?>" <?php
 
1816
  if ( isset( $options['ddp_schedule'] ) && esc_attr( $key ) === $options['ddp_schedule'] ) {
1817
  echo esc_html( 'selected="selected"' ) ;
1818
  }
1819
+ ?>><?php
 
1820
  echo esc_html( $sch['display'] ) ;
1821
  ?></option>
1822
+ <?php
1823
  }
1824
  }
1825
  ?>
1826
+ </select>
1827
+ <p class="description">
1828
+ <?php
1829
  esc_html_e( 'How often should the cron job run?', 'delete-duplicate-posts' );
1830
  ?></p>
1831
+ </td>
1832
+ </tr>
1833
 
1834
 
1835
 
1836
+ <tr>
1837
+ <td colspan="2">
1838
+ <hr>
1839
+ </td>
1840
+ </tr>
1841
 
1842
+ <tr>
1843
+ <th><?php
1844
  esc_html_e( 'Send status mail?:', 'delete-duplicate-posts' );
1845
  ?></th>
1846
+ <td>
1847
+ <label for="ddp_statusmail">
1848
+ <input type="checkbox" id="ddp_statusmail" name="ddp_statusmail" <?php
 
1849
  if ( isset( $options['ddp_statusmail'] ) && true === $options['ddp_statusmail'] ) {
1850
  echo 'checked="checked"' ;
1851
  }
1852
+ ?>>
1853
+ <p class="description">
1854
+ <?php
1855
  esc_html_e( 'Sends a status email if duplicates have been found.', 'delete-duplicate-posts' );
1856
  ?>
1857
+ </p>
1858
+ </label>
1859
+ </td>
1860
+ </tr>
1861
 
1862
+ <tr>
1863
+ <th><?php
1864
  esc_html_e( 'Email recipient:', 'delete-duplicate-posts' );
1865
  ?></th>
1866
+ <td>
1867
+ <label for="ddp_statusmail_recipient">
1868
 
1869
+ <input type="text" class="regular-text" id="ddp_statusmail_recipient"
1870
+ name="ddp_statusmail_recipient"
1871
+ value="<?php
1872
  echo esc_html( $options['ddp_statusmail_recipient'] ) ;
1873
  ?>">
1874
+ <p class="description">
1875
+ <?php
1876
  esc_html_e( 'Who should get the notification email.', 'delete-duplicate-posts' );
1877
  ?></p>
1878
+ </label>
1879
+ </td>
1880
+ </tr>
1881
 
1882
 
1883
 
1884
+ <tr>
1885
+ <td colspan="2">
1886
+ <hr>
1887
+ </td>
1888
+ </tr>
1889
 
1890
+ <tr>
1891
+ <th><?php
1892
+ esc_html_e( 'Enable debug logging?:', 'delete-duplicate-posts' );
1893
+ ?></th>
1894
+ <td>
1895
+ <label for="ddp_debug">
1896
+ <input type="checkbox" id="ddp_debug" name="ddp_debug" <?php
1897
+ if ( isset( $options['ddp_debug'] ) && true === $options['ddp_debug'] ) {
1898
+ echo 'checked="checked"' ;
1899
+ }
1900
+ ?>>
1901
+ <p class="description">
1902
+ <?php
1903
+ esc_html_e( 'Should only be enabled if debugging a problem.', 'delete-duplicate-posts' );
1904
+ ?>
1905
+ </p>
1906
+ </label>
1907
+ </td>
1908
+ </tr>
1909
+ <th colspan=2><input type="submit" class="button-primary" name="delete_duplicate_posts_save"
1910
+ value="<?php
1911
  esc_html_e( 'Save Settings', 'delete-duplicate-posts' );
1912
  ?>" /></th>
1913
+ </tr>
1914
+ </table>
1915
+ </form>
1916
+ </div><!-- #configuration -->
1917
+ <div id="log">
1918
+ <h3><?php
 
 
 
 
 
1919
  esc_html_e( 'The Log', 'delete-duplicate-posts' );
1920
  ?></h3>
1921
+ <div class="spinner is-active"></div>
1922
+ <ul class="large-text" name="ddp_log" id="ddp_log">
1923
+ </ul>
1924
+ </div>
1925
+ <p>
1926
+ <form method="post" id="ddp_clearlog">
1927
+ <?php
 
1928
  wp_nonce_field( 'ddp_clearlog_nonce' );
1929
  ?>
1930
+ <input class="button-secondary" type="submit" name="ddp_clearlog"
1931
+ value="<?php
1932
  esc_html_e( 'Reset log', 'delete-duplicate-posts' );
1933
  ?>" />
1934
+ </form>
1935
+ </p>
1936
+ </div><!-- #ddp_container -->
1937
+ <?php
 
 
1938
  include_once 'sidebar.php';
 
 
 
1939
  if ( function_exists( 'ddp_fs' ) ) {
1940
  global $ddp_fs ;
1941
  }
1942
  ?>
1943
 
1944
+ </div>
1945
+ </div>
1946
 
1947
+ </div>
1948
  <?php
1949
  }
1950
 
freemius/README.html DELETED
@@ -1,296 +0,0 @@
1
- <!DOCTYPE html>
2
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3
- <head>
4
- <meta charset="utf-8"/>
5
- </head>
6
- <body>
7
-
8
- <h1 id="freemiuswordpresssdk">Freemius WordPress SDK</h1>
9
-
10
- <p>Welcome to the official repository for the Freemius SDK! Adding the SDK to your WordPress plugin, theme, or add-ons, enables all the benefits that come with using the <a href="https://freemius.com">Freemius platform</a> such as:</p>
11
-
12
- <ul>
13
- <li><p><a href="https://freemius.com/wordpress/software-licensing/">Software Licensing</a></p></li>
14
- <li><p><a href="https://freemius.com/wordpress/checkout/">Secure Checkout</a></p></li>
15
- <li><p><a href="https://freemius.com/wordpress/recurring-payments-subscriptions/">Subscriptions</a></p></li>
16
- <li><p><a href="https://freemius.com/wordpress/automatic-software-updates/">Automatic Updates</a></p></li>
17
- <li><p><a href="https://freemius.com/wordpress/collecting-eu-vat-europe/">Seamless EU VAT</a></p></li>
18
- <li><p><a href="https://freemius.com/wordpress/cart-abandonment-recovery/">Cart Abandonment Recovery</a></p></li>
19
- <li><p><a href="https://freemius.com/wordpress/affiliate-platform/">Affiliate Platform</a></p></li>
20
- <li><p><a href="https://freemius.com/wordpress/insights/">Analytics &amp; Usage Tracking</a></p></li>
21
- <li><p><a href="https://freemius.com/wordpress/user-dashboard/">User Dashboard</a></p></li>
22
- <li><p><a href="https://freemius.com/wordpress/">Monetization</a></p></li>
23
- <li><p><a href="https://freemius.com/wordpress/insights/">Analytics</a></p></li>
24
- <li><p><a href="https://freemius.com/wordpress/features-comparison/">More&#8230;</a></p></li>
25
- </ul>
26
-
27
- <p>Freemius truly empowers developers to create prosperous subscription-based businesses.</p>
28
-
29
- <p>If you&#8217;re new to Freemius then we recommend taking a look at our <a href="https://freemius.com/help/documentation/getting-started/">Getting Started</a> guide first.</p>
30
-
31
- <p>If you&#8217;re a WordPress plugin or theme developer and are interested in monetizing with Freemius then you can <a href="https://dashboard.freemius.com/register/">sign-up for a FREE account</a>:</p>
32
-
33
- <p>https://dashboard.freemius.com/register/</p>
34
-
35
- <p>Once you have your account setup and are familiar with how it all works you&#8217;re ready to begin <a href="https://freemius.com/help/documentation/wordpress-sdk/integrating-freemius-sdk/">integrating Freemius</a> into your WordPress product</p>
36
-
37
- <p>You can see some of the existing WordPress.org plugins &amp; themes that are already utilizing the power of Freemius here:</p>
38
-
39
- <ul>
40
- <li>https://profiles.wordpress.org/freemius/#content-plugins</li>
41
- <li>https://includewp.com/freemius/#focus</li>
42
- </ul>
43
-
44
- <h2 id="codedocumentation">Code Documentation</h2>
45
-
46
- <p>You can find the SDK&#8217;s documentation here:
47
- https://freemius.com/help/documentation/wordpress-sdk/</p>
48
-
49
- <h2 id="integratinginitializingthesdk">Integrating &amp; Initializing the SDK</h2>
50
-
51
- <p>As part of the integration process, you&#8217;ll need to <a href="https://freemius.com/help/documentation/getting-started/#add_the_latest_wordpress_sdk_into_your_product">add the latest version</a> of the Freemius SDK into your WordPress project.</p>
52
-
53
- <p>Then, when you&#8217;ve completed the <a href="https://freemius.com/help/documentation/getting-started/#fill_out_the_sdk_integration_form">SDK integration form</a> a snippet of code is generated which you&#8217;ll need to copy and paste into the top of your main plugin&#8217;s PHP file, right after the plugin&#8217;s header comment.</p>
54
-
55
- <p>Note: For themes, this will be in the root <code>functions.php</code> file instead.</p>
56
-
57
- <p>A typical SDK snippet will look similar to the following (your particular snippet may differ slightly depending on your integration):</p>
58
-
59
- <pre><code class="php">if ( ! function_exists( 'my_prefix_fs' ) ) {
60
- // Create a helper function for easy SDK access.
61
- function my_prefix_fs() {
62
- global $my_prefix_fs;
63
-
64
- if ( ! isset( $my_prefix_fs ) ) {
65
- // Include Freemius SDK.
66
- require_once dirname(__FILE__) . '/freemius/start.php';
67
-
68
- $my_prefix_fs = fs_dynamic_init( array(
69
- 'id' =&gt; '1234',
70
- 'slug' =&gt; 'my-new-plugin',
71
- 'premium_slug' =&gt; 'my-new-plugin-premium',
72
- 'type' =&gt; 'plugin',
73
- 'public_key' =&gt; 'pk_bAEfta69seKymZzmf2xtqq8QXHz9y',
74
- 'is_premium' =&gt; true,
75
- // If your plugin is a serviceware, set this option to false.
76
- 'has_premium_version' =&gt; true,
77
- 'has_paid_plans' =&gt; true,
78
- 'is_org_compliant' =&gt; true,
79
- 'menu' =&gt; array(
80
- 'slug' =&gt; 'my-new-plugin',
81
- 'parent' =&gt; array(
82
- 'slug' =&gt; 'options-general.php',
83
- ),
84
- ),
85
- // Set the SDK to work in a sandbox mode (for development &amp; testing).
86
- // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
87
- 'secret_key' =&gt; 'sk_ubb4yN3mzqGR2x8#P7r5&amp;@*xC$utE',
88
- ) );
89
- }
90
-
91
- return $my_prefix_fs;
92
- }
93
-
94
- // Init Freemius.
95
- my_prefix_fs();
96
- // Signal that SDK was initiated.
97
- do_action( 'my_prefix_fs_loaded' );
98
- }
99
-
100
- </code></pre>
101
-
102
- <h2 id="usageexample">Usage example</h2>
103
-
104
- <p>You can call anySDK methods by prefixing them with the shortcode function for your particular plugin/theme (specified when completing the SDK integration form in the Developer Dashboard):</p>
105
-
106
- <pre><code class="php">&lt;?php my_prefix_fs()-&gt;get_upgrade_url(); ?&gt;
107
- </code></pre>
108
-
109
- <p>Or when calling Freemius multiple times in a scope, it&#8217;s recommended to use it with the global variable:</p>
110
-
111
- <pre><code class="php">&lt;?php
112
- global $my_prefix_fs;
113
- $my_prefix_fs-&gt;get_account_url();
114
- ?&gt;
115
- </code></pre>
116
-
117
- <p>There are many other SDK methods available that you can use to enhance the functionality of your WordPress product. Some of the more common use-cases are covered in the <a href="https://freemius.com/help/documentation/wordpress-sdk/gists/">Freemius SDK Gists</a> documentation.</p>
118
-
119
- <h2 id="addinglicensebasedlogicexamples">Adding license based logic examples</h2>
120
-
121
- <p>Add marketing content to encourage your users to upgrade for your paid version:</p>
122
-
123
- <pre><code class="php">&lt;?php
124
- if ( my_prefix_fs()-&gt;is_not_paying() ) {
125
- echo '&lt;section&gt;&lt;h1&gt;' . esc_html__('Awesome Premium Features', 'my-plugin-slug') . '&lt;/h1&gt;';
126
- echo '&lt;a href=&quot;' . my_prefix_fs()-&gt;get_upgrade_url() . '&quot;&gt;' .
127
- esc_html__('Upgrade Now!', 'my-plugin-slug') .
128
- '&lt;/a&gt;';
129
- echo '&lt;/section&gt;';
130
- }
131
- ?&gt;
132
- </code></pre>
133
-
134
- <p>Add logic which will only be available in your premium plugin version:</p>
135
-
136
- <pre><code class="php">&lt;?php
137
- // This &quot;if&quot; block will be auto removed from the Free version.
138
- if ( my_prefix_fs()-&gt;is__premium_only() ) {
139
-
140
- // ... premium only logic ...
141
-
142
- }
143
- ?&gt;
144
- </code></pre>
145
-
146
- <p>To add a function which will only be available in your premium plugin version, simply add __premium_only as the suffix of the function name. Just make sure that all lines that call that method directly or by hooks, are also wrapped in premium only logic:</p>
147
-
148
- <pre><code class="php">&lt;?php
149
- class My_Plugin {
150
- function init() {
151
- ...
152
-
153
- // This &quot;if&quot; block will be auto removed from the free version.
154
- if ( my_prefix_fs()-&gt;is__premium_only() ) {
155
- // Init premium version.
156
- $this-&gt;admin_init__premium_only();
157
-
158
- add_action( 'admin_init', array( &amp;$this, 'admin_init_hook__premium_only' );
159
- }
160
-
161
- ...
162
- }
163
-
164
- // This method will be only included in the premium version.
165
- function admin_init__premium_only() {
166
- ...
167
- }
168
-
169
- // This method will be only included in the premium version.
170
- function admin_init_hook__premium_only() {
171
- ...
172
- }
173
- }
174
- ?&gt;
175
- </code></pre>
176
-
177
- <p>Add logic which will only be executed for customers in your &#8216;professional&#8217; plan:</p>
178
-
179
- <pre><code class="php">&lt;?php
180
- if ( my_prefix_fs()-&gt;is_plan('professional', true) ) {
181
- // .. logic related to Professional plan only ...
182
- }
183
- ?&gt;
184
- </code></pre>
185
-
186
- <p>Add logic which will only be executed for customers in your &#8216;professional&#8217; plan or higher plans:</p>
187
-
188
- <pre><code class="php">&lt;?php
189
- if ( my_prefix_fs()-&gt;is_plan('professional') ) {
190
- // ... logic related to Professional plan and higher plans ...
191
- }
192
- ?&gt;
193
- </code></pre>
194
-
195
- <p>Add logic which will only be available in your premium plugin version AND will only be executed for customers in your &#8216;professional&#8217; plan (and higher plans):</p>
196
-
197
- <pre><code class="php">&lt;?php
198
- // This &quot;if&quot; block will be auto removed from the Free version.
199
- if ( my_prefix_fs()-&gt;is_plan__premium_only('professional') ) {
200
- // ... logic related to Professional plan and higher plans ...
201
- }
202
- ?&gt;
203
- </code></pre>
204
-
205
- <p>Add logic only for users in trial:</p>
206
-
207
- <pre><code class="php">&lt;?php
208
- if ( my_prefix_fs()-&gt;is_trial() ) {
209
- // ... logic for users in trial ...
210
- }
211
- ?&gt;
212
- </code></pre>
213
-
214
- <p>Add logic for specified paid plan:</p>
215
-
216
- <pre><code class="php">&lt;?php
217
- // This &quot;if&quot; block will be auto removed from the Free version.
218
- if ( my_prefix_fs()-&gt;is__premium_only() ) {
219
- if ( my_prefix_fs()-&gt;is_plan( 'professional', true ) ) {
220
-
221
- // ... logic related to Professional plan only ...
222
-
223
- } else if ( my_prefix_fs()-&gt;is_plan( 'business' ) ) {
224
-
225
- // ... logic related to Business plan and higher plans ...
226
-
227
- }
228
- }
229
- ?&gt;
230
- </code></pre>
231
-
232
- <h2 id="excludingfilesandfoldersfromthefreepluginversion">Excluding files and folders from the free plugin version</h2>
233
-
234
- <p>There are <a href="https://freemius.com/help/documentation/wordpress-sdk/software-licensing/#excluding_files_and_folders_from_the_free_plugin_version">two ways</a> to exclude files from your free version.</p>
235
-
236
- <ol>
237
- <li>Add <code>__premium_only</code> just before the file extension. For example, functions__premium_only.php will be only included in the premium plugin version. This works for all types of files, not only PHP.</li>
238
- <li>Add <code>@fs_premium_only</code> a special meta tag to the plugin&#8217;s main PHP file header. Example:</li>
239
- </ol>
240
-
241
- <pre><code class="php">&lt;?php
242
- /**
243
- * Plugin Name: My Very Awesome Plugin
244
- * Plugin URI: http://my-awesome-plugin.com
245
- * Description: Create and manage Awesomeness right in WordPress.
246
- * Version: 1.0.0
247
- * Author: Awesomattic
248
- * Author URI: http://my-awesome-plugin.com/me/
249
- * License: GPLv2
250
- * Text Domain: myplugin
251
- * Domain Path: /langs
252
- *
253
- * @fs_premium_only /lib/functions.php, /premium-files/
254
- */
255
-
256
- if ( ! defined( 'ABSPATH' ) ) {
257
- exit;
258
- }
259
-
260
- // ... my code ...
261
- ?&gt;
262
- </code></pre>
263
-
264
- <p>In the example plugin header above, the file <code>/lib/functions.php</code> and the directory <code>/premium-files/</code> will be removed from the free plugin version.</p>
265
-
266
- <h1 id="wordpress.orgcompliance">WordPress.org Compliance</h1>
267
-
268
- <p>Based on <a href="https://wordpress.org/plugins/about/guidelines/">WordPress.org Guidelines</a> you are not allowed to submit a plugin that has premium code in it:</p>
269
-
270
- <blockquote>
271
- <p>All code hosted by WordPress.org servers must be free and fully-functional. If you want to sell advanced features for a plugin (such as a &#8220;pro&#8221; version), then you must sell and serve that code from your own site, we will not host it on our servers.</p>
272
- </blockquote>
273
-
274
- <p>Therefore, if you want to deploy your free plugin&#8217;s version to WordPress.org, make sure you wrap all your premium code with <code>if ( my_prefix_fs()-&gt;{{ method }}__premium_only() )</code> or use <a href="https://freemius.com/help/documentation/wordpress-sdk/software-licensing/">some of the other methods</a> provided by the SDK to exclude premium features &amp; files from the free version.</p>
275
-
276
- <h2 id="deployment">Deployment</h2>
277
-
278
- <p>Zip your Freemius product’s root folder and <a href="https://freemius.com/help/documentation/selling-with-freemius/deployment/">upload it in the Deployment section</a> in the <em>Freemius Developer&#8217;s Dashboard</em>.
279
- The plugin/theme will automatically be scanned and processed by a custom-developed <em>PHP Processor</em> which will auto-generate two versions of your plugin:</p>
280
-
281
- <ol>
282
- <li><strong>Premium version</strong>: Identical to your uploaded version, including all code (except your <code>secret_key</code>). Will be enabled for download ONLY for your paying or in trial customers.</li>
283
- <li><strong>Free version</strong>: The code stripped from all your paid features (based on the logic added wrapped in <code>{ method }__premium_only()</code>).</li>
284
- </ol>
285
-
286
- <p>The free version is the one that you should give your users to download. Therefore, download the free generated version and upload to your site. Or, if your plugin was WordPress.org compliant and you made sure to exclude all your premium code with the different provided techniques, you can deploy the downloaded free version to the .org repo.</p>
287
-
288
- <h2 id="license">License</h2>
289
-
290
- <p>Copyright (c) Freemius®, Inc.</p>
291
-
292
- <p>Licensed under the GNU general public license (version 3).</p>
293
-
294
- </body>
295
- </html>
296
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/delete-duplicate-posts-min.js CHANGED
@@ -1 +1 @@
1
- "use strict";function cp_ddp_freemius_opt_in(e){var t=jQuery("#cp-ddp-freemius-opt-nonce").val(),a=jQuery(e).data("opt");jQuery("#cp-ddp-opt-spin").addClass("is-active"),jQuery.ajax({type:"POST",url:ajaxurl,async:!0,data:{action:"cp_ddp_freemius_opt_in",opt_nonce:t,choice:a},success:function(){jQuery("#cp-ddp-opt-spin").removeClass("is-active"),location.reload()},error:function(e,t,a){console.log(e.statusText),console.log(t),console.log(a)}})}jQuery(document).ready((function(){var e=[];function t(){jQuery("#ddp_log").empty(),jQuery.ajax({type:"POST",url:ajaxurl,data:{_ajax_nonce:cp_ddp.loglines_nonce,action:"ddp_get_loglines"},dataType:"json",success:function(e){var t=e.data.results;t&&jQuery.each(t,(function(e,t){jQuery("#ddp_log").append("<li><code>"+t.datime+"</code> "+t.note+"</li>")})),jQuery("#log .spinner").removeClass("is-active")}}).fail((function(e){jQuery("#log .spinner").removeClass("is-active"),window.console&&window.console.log&&window.console.log(e.statusCode+" "+e.statusText)}))}function a(e,d,o){jQuery("#ddp_container #ddp_buttons input").each((function(){jQuery(this).prop("disabled",!0)})),jQuery("#ddp_container #dashboard .spinner").addClass("is-active"),jQuery.ajax({type:"POST",url:ajaxurl,data:{_ajax_nonce:cp_ddp.nonce,action:"ddp_get_duplicates",stepid:e},dataType:"json",success:function(e){var s=e.data.dupes;s?(jQuery("#ddp_container #dashboard .statusdiv .statusmessage").html(e.data.msg).show(),jQuery("#ddp_container #dashboard .statusdiv .dupelist .duplicatetable").show(),jQuery.each(s,(function(e,t){jQuery("#ddp_container #dashboard .statusdiv .dupelist .duplicatetable tbody").append('<tr><th scope="row" class="check-column"><label class="screen-reader-text" for="cb-select-'+t.ID+'">Select Post</label><input id="cb-select-'+t.ID+'" type="checkbox" name="delpost[]" value="'+t.ID+'"><div class="locked-indicator"></div></th><td><a href="'+t.permalink+'" target="_blank">'+t.title+"</a> (ID #"+t.ID+" type:"+t.type+" status:"+t.status+')</td><td><a href="'+t.orgpermalink+'" target="_blank">'+t.orgtitle+"</a> (ID #"+t.orgID+")"+t.why+"</td></tr>")})),jQuery("#ddp_container #dashboard .statusdiv .dupelist .duplicatetable tbody").slideDown(),jQuery("#ddp_container #ddp_buttons input").each((function(){jQuery(this).prop("disabled",!1)}))):jQuery("#ddp_container #dashboard .statusdiv .statusmessage").html(e.data.msg).show(),jQuery("#ddp_container #dashboard .spinner").removeClass("is-active"),"-1"==e.data.nextstep||parseInt(e.data.nextstep)>0&&a(parseInt(e.data.nextstep),d,o),t()}}).fail((function(e){t(),jQuery("#ddp_container #dashboard .spinner").removeClass("is-active"),window.console&&window.console.log&&window.console.log(e.statusCode+" "+e.statusText)}))}e.stepid=0,a(1,e),jQuery(document).on("click","#deleteduplicateposts_deleteall",(function(d){d.preventDefault(),jQuery("#log .spinner").addClass("is-active");var o=[];if(jQuery(".duplicatetable input[name='delpost[]']:checked").each((function(){o.push(parseInt(jQuery(this).val()))})),void 0===o||0===o.length)return alert(cp_ddp.text_selectsomething),!1;confirm(cp_ddp.text_areyousure)&&(jQuery("#ddp_container .dupelist .duplicatetable tbody").empty(),jQuery.ajax({type:"POST",url:ajaxurl,data:{_ajax_nonce:cp_ddp.deletedupes_nonce,action:"ddp_delete_duplicates",checked_posts:o},dataType:"json",success:function(){a(1,e),t()}}).fail((function(d){jQuery("#log .spinner").removeClass("is-active"),window.console&&window.console.log&&(window.console.log(d.statusCode+" "+d.statusText),a(1,e),t())})))})),jQuery(document).on("click","#deleteduplicateposts_resetview",(function(d){d.preventDefault(),jQuery("#ddp_container .dupelist .duplicatetable tbody").empty(),a(1,e),t()})),jQuery(document).on("click",".ddpcomparemethod li",(function(){jQuery(".ddpcomparemethod input:radio").each((function(){this.checked?jQuery(this).closest("li").find(".ddp-compare-details").show():jQuery(this).closest("li").find(".ddp-compare-details").hide()}))})),jQuery(".ddpcomparemethod li").trigger("click")}));
1
+ "use strict";function cp_ddp_freemius_opt_in(e){var t=jQuery("#cp-ddp-freemius-opt-nonce").val(),a=jQuery(e).data("opt");jQuery("#cp-ddp-opt-spin").addClass("is-active"),jQuery.ajax({type:"POST",url:ajaxurl,async:!0,data:{action:"cp_ddp_freemius_opt_in",opt_nonce:t,choice:a},success:function(){jQuery("#cp-ddp-opt-spin").removeClass("is-active"),location.reload()},error:function(e,t,a){console.log(e.statusText),console.log(t),console.log(a)}})}jQuery(document).ready((function(){var e=[];function t(){jQuery("#ddp_log").empty(),jQuery.ajax({type:"POST",url:ajaxurl,data:{_ajax_nonce:cp_ddp.loglines_nonce,action:"ddp_get_loglines"},dataType:"json",success:function(e){var t=e.data.results;t&&jQuery.each(t,(function(e,t){jQuery("#ddp_log").append("<li><code>"+t.datime+"</code> "+t.note+"</li>")})),jQuery("#log .spinner").removeClass("is-active")}}).fail((function(e){jQuery("#log .spinner").removeClass("is-active"),window.console&&window.console.log&&window.console.log(e.statusCode+" "+e.statusText)}))}function a(e,t,d){jQuery("#ddp_container #ddp_buttons input").each((function(){jQuery(this).prop("disabled",!0)})),jQuery("#ddp_container #dashboard .spinner").addClass("is-active"),jQuery.ajax({type:"POST",url:ajaxurl,data:{_ajax_nonce:cp_ddp.nonce,action:"ddp_get_duplicates",stepid:e},dataType:"json",success:function(e){var o=e.data.dupes;o?(jQuery("#ddp_container #dashboard .statusdiv .statusmessage").html(e.data.msg).show(),jQuery("#ddp_container #dashboard .statusdiv .dupelist .duplicatetable").show(),jQuery.each(o,(function(e,t){jQuery("#ddp_container #dashboard .statusdiv .dupelist .duplicatetable tbody").append('<tr><th scope="row" class="check-column"><label class="screen-reader-text" for="cb-select-'+t.ID+'">Select Post</label><input id="cb-select-'+t.ID+'" type="checkbox" name="delpost[]" value="'+t.ID+'"><div class="locked-indicator"></div></th><td><a href="'+t.permalink+'" target="_blank">'+t.title+"</a> (ID #"+t.ID+" type:"+t.type+" status:"+t.status+')</td><td><a href="'+t.orgpermalink+'" target="_blank">'+t.orgtitle+"</a> (ID #"+t.orgID+") "+t.why+"</td></tr>")})),jQuery("#ddp_container #dashboard .statusdiv .dupelist .duplicatetable tbody").slideDown(),jQuery("#ddp_container #ddp_buttons input").each((function(){jQuery(this).prop("disabled",!1)}))):jQuery("#ddp_container #dashboard .statusdiv .statusmessage").html(e.data.msg).show(),jQuery("#ddp_container #dashboard .spinner").removeClass("is-active"),"-1"==e.data.nextstep||parseInt(e.data.nextstep)>0&&a(parseInt(e.data.nextstep),t,d)}}).fail((function(e){jQuery("#ddp_container #dashboard .spinner").removeClass("is-active"),window.console&&window.console.log&&window.console.log(e.statusCode+" "+e.statusText)}))}e.stepid=0,a(1,e),t(),jQuery(document).on("click","#deleteduplicateposts_deleteall",(function(d){d.preventDefault(),jQuery("#log .spinner").addClass("is-active");var o=[];if(jQuery(".duplicatetable input[name='delpost[]']:checked").each((function(){o.push(parseInt(jQuery(this).val()))})),void 0===o||0===o.length)return alert(cp_ddp.text_selectsomething),!1;confirm(cp_ddp.text_areyousure)&&(jQuery("#ddp_container .dupelist .duplicatetable tbody").empty(),jQuery.ajax({type:"POST",url:ajaxurl,data:{_ajax_nonce:cp_ddp.deletedupes_nonce,action:"ddp_delete_duplicates",checked_posts:o},dataType:"json",success:function(){a(1,e),t()}}).fail((function(d){jQuery("#log .spinner").removeClass("is-active"),window.console&&window.console.log&&window.console.log(d.statusCode+" "+d.statusText),a(1,e),t()})))})),jQuery(document).on("click","#deleteduplicateposts_resetview",(function(d){d.preventDefault(),jQuery("#ddp_container .dupelist .duplicatetable tbody").empty(),a(1,e),t()})),jQuery(document).on("click",".ddpcomparemethod li",(function(){jQuery(".ddpcomparemethod input:radio").each((function(){this.checked?jQuery(this).closest("li").find(".ddp-compare-details").show():jQuery(this).closest("li").find(".ddp-compare-details").hide()}))})),jQuery(".ddpcomparemethod li").trigger("click")}));
js/delete-duplicate-posts.js CHANGED
@@ -31,7 +31,7 @@ jQuery(document).ready(function () {
31
  let senddata = [];
32
  senddata['stepid'] = 0;
33
  ddp_get_duplicates(1, senddata); // @todo
34
-
35
 
36
  // DELETE DUPES
37
  jQuery(document).on('click', '#deleteduplicateposts_deleteall', function (e) {
@@ -49,7 +49,7 @@ jQuery(document).ready(function () {
49
 
50
  if (!confirm(cp_ddp.text_areyousure)) {
51
  return;
52
- }
53
 
54
  jQuery('#ddp_container .dupelist .duplicatetable tbody').empty();
55
 
@@ -65,18 +65,17 @@ jQuery(document).ready(function () {
65
  success: function () {
66
  ddp_get_duplicates(1, senddata);
67
  ddp_refresh_log();
68
- // location.reload(true);
69
  }
70
  }).fail(function (response) {
71
  jQuery('#log .spinner').removeClass('is-active');
72
  if (window.console && window.console.log) {
73
  window.console.log(response.statusCode + ' ' + response.statusText);
74
- ddp_get_duplicates(1, senddata);
75
- ddp_refresh_log();
76
- // location.reload(true);
77
  }
 
 
78
  });
79
 
 
80
  });
81
 
82
 
@@ -99,7 +98,6 @@ jQuery(document).ready(function () {
99
  * @return void
100
  */
101
  function ddp_refresh_log() {
102
- // REFRESH LOG
103
  jQuery('#ddp_log').empty();
104
  jQuery.ajax({
105
  type: 'POST',
@@ -129,12 +127,13 @@ jQuery(document).ready(function () {
129
 
130
 
131
  /**
 
132
  *
133
  * @author Lars Koudal
134
  * @since v0.0.1
135
- * @version v1.0.0 Sunday, January 10th, 2021.
136
- * @global
137
- * @param mixed stepid - integer, starts at 1
138
  * @param mixed data
139
  * @param mixed self
140
  * @return void
@@ -191,10 +190,10 @@ jQuery(document).ready(function () {
191
  ddp_get_duplicates(parseInt(response.data.nextstep), data, self);
192
  }
193
  }
194
- ddp_refresh_log();
195
  }
196
  }).fail(function (response) {
197
- ddp_refresh_log();
198
  jQuery('#ddp_container #dashboard .spinner').removeClass('is-active');
199
 
200
  if (window.console && window.console.log) {
31
  let senddata = [];
32
  senddata['stepid'] = 0;
33
  ddp_get_duplicates(1, senddata); // @todo
34
+ ddp_refresh_log();
35
 
36
  // DELETE DUPES
37
  jQuery(document).on('click', '#deleteduplicateposts_deleteall', function (e) {
49
 
50
  if (!confirm(cp_ddp.text_areyousure)) {
51
  return;
52
+ }
53
 
54
  jQuery('#ddp_container .dupelist .duplicatetable tbody').empty();
55
 
65
  success: function () {
66
  ddp_get_duplicates(1, senddata);
67
  ddp_refresh_log();
 
68
  }
69
  }).fail(function (response) {
70
  jQuery('#log .spinner').removeClass('is-active');
71
  if (window.console && window.console.log) {
72
  window.console.log(response.statusCode + ' ' + response.statusText);
 
 
 
73
  }
74
+ ddp_get_duplicates(1, senddata);
75
+ ddp_refresh_log();
76
  });
77
 
78
+
79
  });
80
 
81
 
98
  * @return void
99
  */
100
  function ddp_refresh_log() {
 
101
  jQuery('#ddp_log').empty();
102
  jQuery.ajax({
103
  type: 'POST',
127
 
128
 
129
  /**
130
+ * ddp_get_duplicates.
131
  *
132
  * @author Lars Koudal
133
  * @since v0.0.1
134
+ * @version v1.0.0 Sunday, January 10th, 2021.
135
+ * @version v1.0.1 Thursday, June 9th, 2022.
136
+ * @param mixed stepid - integer, starts at 1
137
  * @param mixed data
138
  * @param mixed self
139
  * @return void
190
  ddp_get_duplicates(parseInt(response.data.nextstep), data, self);
191
  }
192
  }
193
+ //ddp_refresh_log();
194
  }
195
  }).fail(function (response) {
196
+ //ddp_refresh_log();
197
  jQuery('#ddp_container #dashboard .spinner').removeClass('is-active');
198
 
199
  if (window.console && window.console.log) {
languages/delete_duplicate_posts.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Delete Duplicate Posts\n"
5
- "POT-Creation-Date: 2022-05-25 14:12-0400\n"
6
  "PO-Revision-Date: 2017-03-30 09:17-0400\n"
7
  "Last-Translator: Lars Koudal\n"
8
  "Language-Team: Lars Koudal\n"
@@ -10,7 +10,7 @@ msgstr ""
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
13
- "X-Generator: Poedit 3.0.1\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
  "X-Poedit-WPHeader: delete-duplicate-posts.php\n"
@@ -33,45 +33,45 @@ msgstr ""
33
  msgid "Freemius opt choice not found."
34
  msgstr ""
35
 
36
- #: delete-duplicate-posts.php:307
37
  msgid "Help Delete Duplicate Posts improve!"
38
  msgstr ""
39
 
40
- #: delete-duplicate-posts.php:310
41
  msgid ""
42
  "Gathering non-sensitive diagnostic data about the plugin install helps us "
43
  "improve the plugin."
44
  msgstr ""
45
 
46
- #: delete-duplicate-posts.php:310
47
  msgid "Read more about what we collect."
48
  msgstr ""
49
 
50
  #. translators:
51
- #: delete-duplicate-posts.php:316
52
  #, php-format
53
  msgid ""
54
  "If you opt-in, some data about your usage of %1$s will be sent to Freemius."
55
  "com. If you skip this, that's okay! %1$s will still work just fine."
56
  msgstr ""
57
 
58
- #: delete-duplicate-posts.php:320
59
  msgid "Sure, opt-in"
60
  msgstr ""
61
 
62
- #: delete-duplicate-posts.php:322
63
  msgid "No, thank you"
64
  msgstr ""
65
 
66
  #. translators: Total number of deleted duplicates
67
  #. translators: %s: Number of deleted posts
68
- #: delete-duplicate-posts.php:347 sidebar.php:39
69
  #, php-format
70
  msgid "%s duplicates deleted!"
71
  msgstr ""
72
 
73
  #. translators: Asking for a review text
74
- #: delete-duplicate-posts.php:353
75
  #, php-format
76
  msgid ""
77
  "Hey, I noticed this plugin has deleted %s duplicate posts for you - that's "
@@ -79,324 +79,332 @@ msgid ""
79
  "WordPress? Just to help us spread the word and boost our motivation."
80
  msgstr ""
81
 
82
- #: delete-duplicate-posts.php:383
83
  msgid "Cleaning duplicates"
84
  msgstr ""
85
 
86
- #: delete-duplicate-posts.php:442
87
  msgid "Error: Log is empty.. do something :-)"
88
  msgstr ""
89
 
90
- #: delete-duplicate-posts.php:675
91
  msgid "Error, choose which meta_key to look for duplicate values in."
92
  msgstr ""
93
 
94
- #: delete-duplicate-posts.php:788
95
  msgid "Error: Choose post types to check."
96
  msgstr ""
97
 
98
- #: delete-duplicate-posts.php:880
99
  msgid "Rendering Help Scouts beacon for easy help and support"
100
  msgstr ""
101
 
102
- #: delete-duplicate-posts.php:887
103
  msgid ""
104
  "Your email is added to cleverplugins.com newsletter. Unsubscribe any time."
105
  msgstr ""
106
 
107
- #: delete-duplicate-posts.php:932
108
  msgid "Cron job running."
109
  msgstr ""
110
 
111
- #: delete-duplicate-posts.php:934
112
  msgid "Manually cleaning."
113
  msgstr ""
114
 
115
- #: delete-duplicate-posts.php:978
116
  #, php-format
117
- msgid "Deleted %1$s '%2$s' (id: %3$s) in %4$s sec."
118
  msgstr ""
119
 
120
  #. translators: How many posts were deleted and how long it took in seconds
121
- #: delete-duplicate-posts.php:986
122
  #, php-format
123
  msgid "A total of %1$s duplicate posts were deleted in %2$s sec."
124
  msgstr ""
125
 
126
  #. translators:
127
- #: delete-duplicate-posts.php:994
128
  #, php-format
129
  msgid "A total of %s duplicate posts were deleted."
130
  msgstr ""
131
 
132
  #. translators:
133
- #: delete-duplicate-posts.php:1012
134
  #, php-format
135
  msgid ""
136
  "Hi Admin, I have deleted <strong>%1$d</strong> posts on your blog, %2$s."
137
  msgstr ""
138
 
139
- #: delete-duplicate-posts.php:1014
140
  msgid ""
141
  "You are receiving this e-mail because you have turned on e-mail "
142
  "notifications by the plugin, Delete Duplicate Posts."
143
  msgstr ""
144
 
145
- #: delete-duplicate-posts.php:1021
146
  msgid "Deleted Duplicate Posts Status"
147
  msgstr ""
148
 
149
  #. translators:
150
- #: delete-duplicate-posts.php:1024
151
  #, php-format
152
  msgid "Status email sent to %s."
153
  msgstr ""
154
 
155
  #. translators:
156
- #: delete-duplicate-posts.php:1028
157
  #, php-format
158
  msgid "Not a vaild email %s."
159
  msgstr ""
160
 
161
- #: delete-duplicate-posts.php:1038
162
  msgid "Every 5 minutes"
163
  msgstr ""
164
 
165
- #: delete-duplicate-posts.php:1042
166
  msgid "Every 10 minutes"
167
  msgstr ""
168
 
169
- #: delete-duplicate-posts.php:1046
170
  msgid "Every 15 minutes"
171
  msgstr ""
172
 
173
- #: delete-duplicate-posts.php:1050
174
  msgid "Every 30 minutes"
175
  msgstr ""
176
 
177
- #: delete-duplicate-posts.php:1112
178
  msgid "Are you sure you want to delete duplicates? There is no undo feature."
179
  msgstr ""
180
 
181
- #: delete-duplicate-posts.php:1113
182
  msgid ""
183
  "You have to select which duplicates to delete. Tip: You can click the top or "
184
  "bottom checkbox to select all."
185
  msgstr ""
186
 
187
- #: delete-duplicate-posts.php:1140
188
  msgid "Plugin activated."
189
  msgstr ""
190
 
191
- #: delete-duplicate-posts.php:1202 delete-duplicate-posts.php:1440
192
  msgid "Settings"
193
  msgstr ""
194
 
195
- #: delete-duplicate-posts.php:1219
196
  msgid "Usage and FAQ"
197
  msgstr ""
198
 
199
- #: delete-duplicate-posts.php:1221
200
  msgid "What does this plugin do?"
201
  msgstr ""
202
 
203
- #: delete-duplicate-posts.php:1222
204
  msgid ""
205
  "Helps you clean duplicate posts from your blog. The plugin checks for "
206
  "blogposts on your blog with the same title."
207
  msgstr ""
208
 
209
- #: delete-duplicate-posts.php:1223
210
  msgid ""
211
  "It can run automatically via WordPress's own internal CRON-system, or you "
212
  "can run it automatically."
213
  msgstr ""
214
 
215
- #: delete-duplicate-posts.php:1224
216
  msgid ""
217
  "It also has a nice feature that can send you an e-mail when Delete Duplicate "
218
  "Posts finds and deletes something (if you have turned on the CRON feature)."
219
  msgstr ""
220
 
221
- #: delete-duplicate-posts.php:1225
222
  msgid "Help! Something was deleted that was not supposed to be deleted!"
223
  msgstr ""
224
 
225
- #: delete-duplicate-posts.php:1226
226
  msgid ""
227
  "I am sorry for that, I can only recommend you restore the database you took "
228
  "just before you ran this plugin."
229
  msgstr ""
230
 
231
- #: delete-duplicate-posts.php:1227
232
  msgid ""
233
  "If you run this plugin, manually or automatically, it is at your OWN risk!"
234
  msgstr ""
235
 
236
- #: delete-duplicate-posts.php:1228
237
  msgid ""
238
  "I have done my best to avoid deleting something that should not be deleted, "
239
  "but if it happens, there is nothing I can do to help you."
240
  msgstr ""
241
 
242
- #: delete-duplicate-posts.php:1250 delete-duplicate-posts.php:1338
243
- #: delete-duplicate-posts.php:1350
244
  msgid "Whoops! Some error occured, try again, please!"
245
  msgstr ""
246
 
247
- #: delete-duplicate-posts.php:1257
248
  msgid ""
249
  "Whoops! There was a problem with the data you posted. Please go back and try "
250
  "again."
251
  msgstr ""
252
 
253
- #: delete-duplicate-posts.php:1332
254
  msgid "Settings saved."
255
  msgstr ""
256
 
257
- #: delete-duplicate-posts.php:1343
258
  msgid "The log was cleared."
259
  msgstr ""
260
 
261
- #: delete-duplicate-posts.php:1410 delete-duplicate-posts.php:1420
262
  msgid "Duplicate"
263
  msgstr ""
264
 
265
- #: delete-duplicate-posts.php:1411 delete-duplicate-posts.php:1421
266
  msgid "Original"
267
  msgstr ""
268
 
269
- #: delete-duplicate-posts.php:1430
270
  msgid "Refresh list"
271
  msgstr ""
272
 
273
- #: delete-duplicate-posts.php:1431
274
  msgid "Delete duplicates"
275
  msgstr ""
276
 
277
- #: delete-duplicate-posts.php:1450
278
  msgid ""
279
  "You have enabled automatic deletion, so I am running on automatic. I will "
280
  "take care of everything..."
281
  msgstr ""
282
 
283
  #. translators: Showing when the next check happens and what the current time is
284
- #: delete-duplicate-posts.php:1456
285
  #, php-format
286
  msgid "Next automated check %1$s. Current time %2$s"
287
  msgstr ""
288
 
289
- #: delete-duplicate-posts.php:1474
290
  msgid "Which post types?:"
291
  msgstr ""
292
 
293
  #. translators: Total number of deleted duplicates
294
- #: delete-duplicate-posts.php:1519
295
  #, php-format
296
  msgid "(%s total found)"
297
  msgstr ""
298
 
299
- #: delete-duplicate-posts.php:1530
300
  msgid "Choose which post types to scan for duplicates."
301
  msgstr ""
302
 
303
- #: delete-duplicate-posts.php:1536
304
  msgid "Post status"
305
  msgstr ""
306
 
307
- #: delete-duplicate-posts.php:1613
308
  msgid "Comparison Method"
309
  msgstr ""
310
 
311
- #: delete-duplicate-posts.php:1620
312
  msgid "Compare by title (default)"
313
  msgstr ""
314
 
315
- #: delete-duplicate-posts.php:1621
316
  msgid "Looks at the title of the post itself."
317
  msgstr ""
318
 
319
- #: delete-duplicate-posts.php:1634
320
  msgid "Compare by meta tag"
321
  msgstr ""
322
 
323
- #: delete-duplicate-posts.php:1635
324
  msgid "Compare by any meta tag."
325
  msgstr ""
326
 
327
- #: delete-duplicate-posts.php:1679
328
  msgid "Delete which posts?:"
329
  msgstr ""
330
 
331
- #: delete-duplicate-posts.php:1689
332
  msgid "Keep oldest"
333
  msgstr ""
334
 
335
- #: delete-duplicate-posts.php:1696
336
  msgid "Keep latest"
337
  msgstr ""
338
 
339
- #: delete-duplicate-posts.php:1699
340
  msgid ""
341
  "Keep the oldest or the latest version of duplicates? Default is keeping the "
342
  "oldest, and deleting any subsequent duplicate posts"
343
  msgstr ""
344
 
345
- #: delete-duplicate-posts.php:1708
346
  msgid "Find how many duplicates:"
347
  msgstr ""
348
 
349
- #: delete-duplicate-posts.php:1715
350
  msgid "No limit"
351
  msgstr ""
352
 
353
- #: delete-duplicate-posts.php:1739
354
  msgid ""
355
  "If you have many duplicates, the plugin might time out before finding them "
356
  "all. Try limiting the amount of duplicates here. Default: Unlimited."
357
  msgstr ""
358
 
359
- #: delete-duplicate-posts.php:1780
360
  msgid "Enable automatic deletion?:"
361
  msgstr ""
362
 
363
- #: delete-duplicate-posts.php:1792
364
  msgid "Clean duplicates automatically."
365
  msgstr ""
366
 
367
- #: delete-duplicate-posts.php:1799
368
  msgid "How often?:"
369
  msgstr ""
370
 
371
- #: delete-duplicate-posts.php:1822
372
  msgid "How often should the cron job run?"
373
  msgstr ""
374
 
375
- #: delete-duplicate-posts.php:1835
376
  msgid "Send status mail?:"
377
  msgstr ""
378
 
379
- #: delete-duplicate-posts.php:1844
380
  msgid "Sends a status email if duplicates have been found."
381
  msgstr ""
382
 
383
- #: delete-duplicate-posts.php:1851
384
  msgid "Email recipient:"
385
  msgstr ""
386
 
387
- #: delete-duplicate-posts.php:1857
388
  msgid "Who should get the notification email."
389
  msgstr ""
390
 
391
- #: delete-duplicate-posts.php:1865
 
 
 
 
 
 
 
 
392
  msgid "Save Settings"
393
  msgstr ""
394
 
395
- #: delete-duplicate-posts.php:1876
396
  msgid "The Log"
397
  msgstr ""
398
 
399
- #: delete-duplicate-posts.php:1886
400
  msgid "Reset log"
401
  msgstr ""
402
 
@@ -424,11 +432,11 @@ msgstr ""
424
  msgid "Our other plugins"
425
  msgstr ""
426
 
427
- #: sidebar.php:122
428
  msgid "Support Forum on WordPress.org"
429
  msgstr ""
430
 
431
- #: sidebar.php:126
432
  msgid "Recreate Databases"
433
  msgstr ""
434
 
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Delete Duplicate Posts\n"
5
+ "POT-Creation-Date: 2022-06-09 20:46-0400\n"
6
  "PO-Revision-Date: 2017-03-30 09:17-0400\n"
7
  "Last-Translator: Lars Koudal\n"
8
  "Language-Team: Lars Koudal\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
13
+ "X-Generator: Poedit 3.1\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
  "X-Poedit-WPHeader: delete-duplicate-posts.php\n"
33
  msgid "Freemius opt choice not found."
34
  msgstr ""
35
 
36
+ #: delete-duplicate-posts.php:314
37
  msgid "Help Delete Duplicate Posts improve!"
38
  msgstr ""
39
 
40
+ #: delete-duplicate-posts.php:317
41
  msgid ""
42
  "Gathering non-sensitive diagnostic data about the plugin install helps us "
43
  "improve the plugin."
44
  msgstr ""
45
 
46
+ #: delete-duplicate-posts.php:317
47
  msgid "Read more about what we collect."
48
  msgstr ""
49
 
50
  #. translators:
51
+ #: delete-duplicate-posts.php:323
52
  #, php-format
53
  msgid ""
54
  "If you opt-in, some data about your usage of %1$s will be sent to Freemius."
55
  "com. If you skip this, that's okay! %1$s will still work just fine."
56
  msgstr ""
57
 
58
+ #: delete-duplicate-posts.php:328
59
  msgid "Sure, opt-in"
60
  msgstr ""
61
 
62
+ #: delete-duplicate-posts.php:331
63
  msgid "No, thank you"
64
  msgstr ""
65
 
66
  #. translators: Total number of deleted duplicates
67
  #. translators: %s: Number of deleted posts
68
+ #: delete-duplicate-posts.php:357 sidebar.php:39
69
  #, php-format
70
  msgid "%s duplicates deleted!"
71
  msgstr ""
72
 
73
  #. translators: Asking for a review text
74
+ #: delete-duplicate-posts.php:363
75
  #, php-format
76
  msgid ""
77
  "Hey, I noticed this plugin has deleted %s duplicate posts for you - that's "
79
  "WordPress? Just to help us spread the word and boost our motivation."
80
  msgstr ""
81
 
82
+ #: delete-duplicate-posts.php:397
83
  msgid "Cleaning duplicates"
84
  msgstr ""
85
 
86
+ #: delete-duplicate-posts.php:463
87
  msgid "Error: Log is empty.. do something :-)"
88
  msgstr ""
89
 
90
+ #: delete-duplicate-posts.php:696
91
  msgid "Error, choose which meta_key to look for duplicate values in."
92
  msgstr ""
93
 
94
+ #: delete-duplicate-posts.php:809
95
  msgid "Error: Choose post types to check."
96
  msgstr ""
97
 
98
+ #: delete-duplicate-posts.php:920
99
  msgid "Rendering Help Scouts beacon for easy help and support"
100
  msgstr ""
101
 
102
+ #: delete-duplicate-posts.php:927
103
  msgid ""
104
  "Your email is added to cleverplugins.com newsletter. Unsubscribe any time."
105
  msgstr ""
106
 
107
+ #: delete-duplicate-posts.php:1005
108
  msgid "Cron job running."
109
  msgstr ""
110
 
111
+ #: delete-duplicate-posts.php:1007
112
  msgid "Manually cleaning."
113
  msgstr ""
114
 
115
+ #: delete-duplicate-posts.php:1053
116
  #, php-format
117
+ msgid "DEBUG: Deleted %1$s '%2$s' (id: %3$s) in %4$s sec."
118
  msgstr ""
119
 
120
  #. translators: How many posts were deleted and how long it took in seconds
121
+ #: delete-duplicate-posts.php:1064
122
  #, php-format
123
  msgid "A total of %1$s duplicate posts were deleted in %2$s sec."
124
  msgstr ""
125
 
126
  #. translators:
127
+ #: delete-duplicate-posts.php:1072 delete-duplicate-posts.php:1081
128
  #, php-format
129
  msgid "A total of %s duplicate posts were deleted."
130
  msgstr ""
131
 
132
  #. translators:
133
+ #: delete-duplicate-posts.php:1099
134
  #, php-format
135
  msgid ""
136
  "Hi Admin, I have deleted <strong>%1$d</strong> posts on your blog, %2$s."
137
  msgstr ""
138
 
139
+ #: delete-duplicate-posts.php:1101
140
  msgid ""
141
  "You are receiving this e-mail because you have turned on e-mail "
142
  "notifications by the plugin, Delete Duplicate Posts."
143
  msgstr ""
144
 
145
+ #: delete-duplicate-posts.php:1108
146
  msgid "Deleted Duplicate Posts Status"
147
  msgstr ""
148
 
149
  #. translators:
150
+ #: delete-duplicate-posts.php:1111
151
  #, php-format
152
  msgid "Status email sent to %s."
153
  msgstr ""
154
 
155
  #. translators:
156
+ #: delete-duplicate-posts.php:1115
157
  #, php-format
158
  msgid "Not a vaild email %s."
159
  msgstr ""
160
 
161
+ #: delete-duplicate-posts.php:1137
162
  msgid "Every 5 minutes"
163
  msgstr ""
164
 
165
+ #: delete-duplicate-posts.php:1141
166
  msgid "Every 10 minutes"
167
  msgstr ""
168
 
169
+ #: delete-duplicate-posts.php:1145
170
  msgid "Every 15 minutes"
171
  msgstr ""
172
 
173
+ #: delete-duplicate-posts.php:1149
174
  msgid "Every 30 minutes"
175
  msgstr ""
176
 
177
+ #: delete-duplicate-posts.php:1211
178
  msgid "Are you sure you want to delete duplicates? There is no undo feature."
179
  msgstr ""
180
 
181
+ #: delete-duplicate-posts.php:1212
182
  msgid ""
183
  "You have to select which duplicates to delete. Tip: You can click the top or "
184
  "bottom checkbox to select all."
185
  msgstr ""
186
 
187
+ #: delete-duplicate-posts.php:1239
188
  msgid "Plugin activated."
189
  msgstr ""
190
 
191
+ #: delete-duplicate-posts.php:1355 delete-duplicate-posts.php:1612
192
  msgid "Settings"
193
  msgstr ""
194
 
195
+ #: delete-duplicate-posts.php:1378
196
  msgid "Usage and FAQ"
197
  msgstr ""
198
 
199
+ #: delete-duplicate-posts.php:1380
200
  msgid "What does this plugin do?"
201
  msgstr ""
202
 
203
+ #: delete-duplicate-posts.php:1381
204
  msgid ""
205
  "Helps you clean duplicate posts from your blog. The plugin checks for "
206
  "blogposts on your blog with the same title."
207
  msgstr ""
208
 
209
+ #: delete-duplicate-posts.php:1382
210
  msgid ""
211
  "It can run automatically via WordPress's own internal CRON-system, or you "
212
  "can run it automatically."
213
  msgstr ""
214
 
215
+ #: delete-duplicate-posts.php:1383
216
  msgid ""
217
  "It also has a nice feature that can send you an e-mail when Delete Duplicate "
218
  "Posts finds and deletes something (if you have turned on the CRON feature)."
219
  msgstr ""
220
 
221
+ #: delete-duplicate-posts.php:1384
222
  msgid "Help! Something was deleted that was not supposed to be deleted!"
223
  msgstr ""
224
 
225
+ #: delete-duplicate-posts.php:1385
226
  msgid ""
227
  "I am sorry for that, I can only recommend you restore the database you took "
228
  "just before you ran this plugin."
229
  msgstr ""
230
 
231
+ #: delete-duplicate-posts.php:1386
232
  msgid ""
233
  "If you run this plugin, manually or automatically, it is at your OWN risk!"
234
  msgstr ""
235
 
236
+ #: delete-duplicate-posts.php:1387
237
  msgid ""
238
  "I have done my best to avoid deleting something that should not be deleted, "
239
  "but if it happens, there is nothing I can do to help you."
240
  msgstr ""
241
 
242
+ #: delete-duplicate-posts.php:1417 delete-duplicate-posts.php:1507
243
+ #: delete-duplicate-posts.php:1518
244
  msgid "Whoops! Some error occured, try again, please!"
245
  msgstr ""
246
 
247
+ #: delete-duplicate-posts.php:1424
248
  msgid ""
249
  "Whoops! There was a problem with the data you posted. Please go back and try "
250
  "again."
251
  msgstr ""
252
 
253
+ #: delete-duplicate-posts.php:1501
254
  msgid "Settings saved."
255
  msgstr ""
256
 
257
+ #: delete-duplicate-posts.php:1511
258
  msgid "The log was cleared."
259
  msgstr ""
260
 
261
+ #: delete-duplicate-posts.php:1577 delete-duplicate-posts.php:1588
262
  msgid "Duplicate"
263
  msgstr ""
264
 
265
+ #: delete-duplicate-posts.php:1578 delete-duplicate-posts.php:1589
266
  msgid "Original"
267
  msgstr ""
268
 
269
+ #: delete-duplicate-posts.php:1600
270
  msgid "Refresh list"
271
  msgstr ""
272
 
273
+ #: delete-duplicate-posts.php:1603
274
  msgid "Delete duplicates"
275
  msgstr ""
276
 
277
+ #: delete-duplicate-posts.php:1622
278
  msgid ""
279
  "You have enabled automatic deletion, so I am running on automatic. I will "
280
  "take care of everything..."
281
  msgstr ""
282
 
283
  #. translators: Showing when the next check happens and what the current time is
284
+ #: delete-duplicate-posts.php:1628
285
  #, php-format
286
  msgid "Next automated check %1$s. Current time %2$s"
287
  msgstr ""
288
 
289
+ #: delete-duplicate-posts.php:1647
290
  msgid "Which post types?:"
291
  msgstr ""
292
 
293
  #. translators: Total number of deleted duplicates
294
+ #: delete-duplicate-posts.php:1692
295
  #, php-format
296
  msgid "(%s total found)"
297
  msgstr ""
298
 
299
+ #: delete-duplicate-posts.php:1704
300
  msgid "Choose which post types to scan for duplicates."
301
  msgstr ""
302
 
303
+ #: delete-duplicate-posts.php:1710
304
  msgid "Post status"
305
  msgstr ""
306
 
307
+ #: delete-duplicate-posts.php:1786
308
  msgid "Comparison Method"
309
  msgstr ""
310
 
311
+ #: delete-duplicate-posts.php:1794
312
  msgid "Compare by title (default)"
313
  msgstr ""
314
 
315
+ #: delete-duplicate-posts.php:1796
316
  msgid "Looks at the title of the post itself."
317
  msgstr ""
318
 
319
+ #: delete-duplicate-posts.php:1810
320
  msgid "Compare by meta tag"
321
  msgstr ""
322
 
323
+ #: delete-duplicate-posts.php:1812
324
  msgid "Compare by any meta tag."
325
  msgstr ""
326
 
327
+ #: delete-duplicate-posts.php:1857
328
  msgid "Delete which posts?:"
329
  msgstr ""
330
 
331
+ #: delete-duplicate-posts.php:1865
332
  msgid "Keep oldest"
333
  msgstr ""
334
 
335
+ #: delete-duplicate-posts.php:1870
336
  msgid "Keep latest"
337
  msgstr ""
338
 
339
+ #: delete-duplicate-posts.php:1873
340
  msgid ""
341
  "Keep the oldest or the latest version of duplicates? Default is keeping the "
342
  "oldest, and deleting any subsequent duplicate posts"
343
  msgstr ""
344
 
345
+ #: delete-duplicate-posts.php:1883
346
  msgid "Find how many duplicates:"
347
  msgstr ""
348
 
349
+ #: delete-duplicate-posts.php:1890
350
  msgid "No limit"
351
  msgstr ""
352
 
353
+ #: delete-duplicate-posts.php:1915
354
  msgid ""
355
  "If you have many duplicates, the plugin might time out before finding them "
356
  "all. Try limiting the amount of duplicates here. Default: Unlimited."
357
  msgstr ""
358
 
359
+ #: delete-duplicate-posts.php:1956
360
  msgid "Enable automatic deletion?:"
361
  msgstr ""
362
 
363
+ #: delete-duplicate-posts.php:1966
364
  msgid "Clean duplicates automatically."
365
  msgstr ""
366
 
367
+ #: delete-duplicate-posts.php:1973
368
  msgid "How often?:"
369
  msgstr ""
370
 
371
+ #: delete-duplicate-posts.php:1994
372
  msgid "How often should the cron job run?"
373
  msgstr ""
374
 
375
+ #: delete-duplicate-posts.php:2007
376
  msgid "Send status mail?:"
377
  msgstr ""
378
 
379
+ #: delete-duplicate-posts.php:2016
380
  msgid "Sends a status email if duplicates have been found."
381
  msgstr ""
382
 
383
+ #: delete-duplicate-posts.php:2023
384
  msgid "Email recipient:"
385
  msgstr ""
386
 
387
+ #: delete-duplicate-posts.php:2031
388
  msgid "Who should get the notification email."
389
  msgstr ""
390
 
391
+ #: delete-duplicate-posts.php:2045
392
+ msgid "Enable debug logging?:"
393
+ msgstr ""
394
+
395
+ #: delete-duplicate-posts.php:2054
396
+ msgid "Should only be enabled if debugging a problem."
397
+ msgstr ""
398
+
399
+ #: delete-duplicate-posts.php:2060
400
  msgid "Save Settings"
401
  msgstr ""
402
 
403
+ #: delete-duplicate-posts.php:2066
404
  msgid "The Log"
405
  msgstr ""
406
 
407
+ #: delete-duplicate-posts.php:2075
408
  msgid "Reset log"
409
  msgstr ""
410
 
432
  msgid "Our other plugins"
433
  msgstr ""
434
 
435
+ #: sidebar.php:126
436
  msgid "Support Forum on WordPress.org"
437
  msgstr ""
438
 
439
+ #: sidebar.php:130
440
  msgid "Recreate Databases"
441
  msgstr ""
442
 
phpcs.xml DELETED
@@ -1,38 +0,0 @@
1
- <?xml version="1.0"?>
2
- <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
3
-
4
- <description>The Coding standard for the WordPress Coding Standards itself.</description>
5
-
6
- <file>.</file>
7
-
8
- <arg value="sp"/>
9
- <arg name="extensions" value="php"/>
10
-
11
- <exclude-pattern>/bin/class-ruleset-test.php</exclude-pattern>
12
- <!-- Exclude Composer vendor directory. -->
13
- <exclude-pattern>*/vendor/*</exclude-pattern>
14
-
15
- <rule ref="WordPress-Extra">
16
- <exclude name="WordPress.Files.FileName"/>
17
- </rule>
18
-
19
- <!-- <rule ref="WordPress-Docs"/> -->
20
-
21
- <!-- Enforce PSR1 compatible namespaces. -->
22
- <rule ref="PSR1.Classes.ClassDeclaration"/>
23
-
24
- <rule ref="WordPress.Arrays.MultipleStatementAlignment">
25
- <properties>
26
- <property name="alignMultilineItems" value="!=100"/>
27
- <property name="exact" value="false" phpcs-only="true"/>
28
- </properties>
29
- </rule>
30
-
31
- <rule ref="PSR2.Methods.FunctionClosingBrace"/>
32
-
33
- <rule ref="WordPress.NamingConventions.PrefixAllGlobals.DeprecatedWhitelistCommentFound">
34
- <!-- False positive for whitelist comment recognition, but no use fixing this now
35
- as the WPCS native whitelist comments are deprecated anyhow. -->
36
- <exclude-pattern>/WordPress/AbstractClassRestrictionsSniff\.php$</exclude-pattern>
37
- </rule>
38
- </ruleset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 4.7
8
  Tested up to: 6.0
9
- Stable tag: 4.7.7
10
  Requires PHP: 5.6
11
 
12
  Get rid of duplicate posts and pages on your blog!
@@ -54,6 +54,14 @@ You should restore the backup you took of your website before you ran this tool.
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
 
57
  = 4.7.7 =
58
  * Fix - Now you can choose how many duplicates to see in the interface.
59
  * Tested with WordPress 6.0.
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 4.7
8
  Tested up to: 6.0
9
+ Stable tag: 4.7.8
10
  Requires PHP: 5.6
11
 
12
  Get rid of duplicate posts and pages on your blog!
54
 
55
  == Changelog ==
56
 
57
+ = 4.7.8 =
58
+ * Fix: Reworked JS code - fixing the list of duplicates not loading.
59
+ * Improved loading time by fixing a few logic issues in the JavaScript code.
60
+ * Added optional debug logging to help pinpoint bugs.
61
+ * Updated language file for translations.
62
+ * Cleaning up PHP code.
63
+ * Trimmed CSS file.
64
+
65
  = 4.7.7 =
66
  * Fix - Now you can choose how many duplicates to see in the interface.
67
  * Tested with WordPress 6.0.
vendor/autoload.php CHANGED
@@ -2,6 +2,11 @@
2
 
3
  // autoload.php @generated by Composer
4
 
 
 
 
 
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
  return ComposerAutoloaderInit011b69449cca0613a375d6d6d222097e::getLoader();
2
 
3
  // autoload.php @generated by Composer
4
 
5
+ if (PHP_VERSION_ID < 50600) {
6
+ echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
7
+ exit(1);
8
+ }
9
+
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
  return ComposerAutoloaderInit011b69449cca0613a375d6d6d222097e::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -37,26 +37,80 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
 
 
 
45
  // PSR-4
 
 
 
 
46
  private $prefixLengthsPsr4 = array();
 
 
 
 
47
  private $prefixDirsPsr4 = array();
 
 
 
 
48
  private $fallbackDirsPsr4 = array();
49
 
50
  // PSR-0
 
 
 
 
51
  private $prefixesPsr0 = array();
 
 
 
 
52
  private $fallbackDirsPsr0 = array();
53
 
 
54
  private $useIncludePath = false;
 
 
 
 
 
55
  private $classMap = array();
 
 
56
  private $classMapAuthoritative = false;
 
 
 
 
 
57
  private $missingClasses = array();
 
 
58
  private $apcuPrefix;
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
@@ -66,28 +120,47 @@ class ClassLoader
66
  return array();
67
  }
68
 
 
 
 
 
69
  public function getPrefixesPsr4()
70
  {
71
  return $this->prefixDirsPsr4;
72
  }
73
 
 
 
 
 
74
  public function getFallbackDirs()
75
  {
76
  return $this->fallbackDirsPsr0;
77
  }
78
 
 
 
 
 
79
  public function getFallbackDirsPsr4()
80
  {
81
  return $this->fallbackDirsPsr4;
82
  }
83
 
 
 
 
 
84
  public function getClassMap()
85
  {
86
  return $this->classMap;
87
  }
88
 
89
  /**
90
- * @param array $classMap Class to filename map
 
 
 
91
  */
92
  public function addClassMap(array $classMap)
93
  {
@@ -102,9 +175,11 @@ class ClassLoader
102
  * Registers a set of PSR-0 directories for a given prefix, either
103
  * appending or prepending to the ones previously set for this prefix.
104
  *
105
- * @param string $prefix The prefix
106
- * @param array|string $paths The PSR-0 root directories
107
- * @param bool $prepend Whether to prepend the directories
 
 
108
  */
109
  public function add($prefix, $paths, $prepend = false)
110
  {
@@ -147,11 +222,13 @@ class ClassLoader
147
  * Registers a set of PSR-4 directories for a given namespace, either
148
  * appending or prepending to the ones previously set for this namespace.
149
  *
150
- * @param string $prefix The prefix/namespace, with trailing '\\'
151
- * @param array|string $paths The PSR-4 base directories
152
- * @param bool $prepend Whether to prepend the directories
153
  *
154
  * @throws \InvalidArgumentException
 
 
155
  */
156
  public function addPsr4($prefix, $paths, $prepend = false)
157
  {
@@ -195,8 +272,10 @@ class ClassLoader
195
  * Registers a set of PSR-0 directories for a given prefix,
196
  * replacing any others previously set for this prefix.
197
  *
198
- * @param string $prefix The prefix
199
- * @param array|string $paths The PSR-0 base directories
 
 
200
  */
201
  public function set($prefix, $paths)
202
  {
@@ -211,10 +290,12 @@ class ClassLoader
211
  * Registers a set of PSR-4 directories for a given namespace,
212
  * replacing any others previously set for this namespace.
213
  *
214
- * @param string $prefix The prefix/namespace, with trailing '\\'
215
- * @param array|string $paths The PSR-4 base directories
216
  *
217
  * @throws \InvalidArgumentException
 
 
218
  */
219
  public function setPsr4($prefix, $paths)
220
  {
@@ -234,6 +315,8 @@ class ClassLoader
234
  * Turns on searching the include path for class files.
235
  *
236
  * @param bool $useIncludePath
 
 
237
  */
238
  public function setUseIncludePath($useIncludePath)
239
  {
@@ -256,6 +339,8 @@ class ClassLoader
256
  * that have not been registered with the class map.
257
  *
258
  * @param bool $classMapAuthoritative
 
 
259
  */
260
  public function setClassMapAuthoritative($classMapAuthoritative)
261
  {
@@ -276,6 +361,8 @@ class ClassLoader
276
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
  *
278
  * @param string|null $apcuPrefix
 
 
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
@@ -296,25 +383,44 @@ class ClassLoader
296
  * Registers this instance as an autoloader.
297
  *
298
  * @param bool $prepend Whether to prepend the autoloader or not
 
 
299
  */
300
  public function register($prepend = false)
301
  {
302
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
 
 
 
 
 
 
 
 
 
 
 
303
  }
304
 
305
  /**
306
  * Unregisters this instance as an autoloader.
 
 
307
  */
308
  public function unregister()
309
  {
310
  spl_autoload_unregister(array($this, 'loadClass'));
 
 
 
 
311
  }
312
 
313
  /**
314
  * Loads the given class or interface.
315
  *
316
  * @param string $class The name of the class
317
- * @return bool|null True if loaded, null otherwise
318
  */
319
  public function loadClass($class)
320
  {
@@ -323,6 +429,8 @@ class ClassLoader
323
 
324
  return true;
325
  }
 
 
326
  }
327
 
328
  /**
@@ -367,6 +475,21 @@ class ClassLoader
367
  return $file;
368
  }
369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  private function findFileWithExtension($class, $ext)
371
  {
372
  // PSR-4 lookup
@@ -438,6 +561,10 @@ class ClassLoader
438
  * Scope isolated include.
439
  *
440
  * Prevents access to $this/self from included files.
 
 
 
 
441
  */
442
  function includeFile($file)
443
  {
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see https://www.php-fig.org/psr/psr-0/
41
+ * @see https://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
45
+ /** @var ?string */
46
+ private $vendorDir;
47
+
48
  // PSR-4
49
+ /**
50
+ * @var array[]
51
+ * @psalm-var array<string, array<string, int>>
52
+ */
53
  private $prefixLengthsPsr4 = array();
54
+ /**
55
+ * @var array[]
56
+ * @psalm-var array<string, array<int, string>>
57
+ */
58
  private $prefixDirsPsr4 = array();
59
+ /**
60
+ * @var array[]
61
+ * @psalm-var array<string, string>
62
+ */
63
  private $fallbackDirsPsr4 = array();
64
 
65
  // PSR-0
66
+ /**
67
+ * @var array[]
68
+ * @psalm-var array<string, array<string, string[]>>
69
+ */
70
  private $prefixesPsr0 = array();
71
+ /**
72
+ * @var array[]
73
+ * @psalm-var array<string, string>
74
+ */
75
  private $fallbackDirsPsr0 = array();
76
 
77
+ /** @var bool */
78
  private $useIncludePath = false;
79
+
80
+ /**
81
+ * @var string[]
82
+ * @psalm-var array<string, string>
83
+ */
84
  private $classMap = array();
85
+
86
+ /** @var bool */
87
  private $classMapAuthoritative = false;
88
+
89
+ /**
90
+ * @var bool[]
91
+ * @psalm-var array<string, bool>
92
+ */
93
  private $missingClasses = array();
94
+
95
+ /** @var ?string */
96
  private $apcuPrefix;
97
 
98
+ /**
99
+ * @var self[]
100
+ */
101
+ private static $registeredLoaders = array();
102
+
103
+ /**
104
+ * @param ?string $vendorDir
105
+ */
106
+ public function __construct($vendorDir = null)
107
+ {
108
+ $this->vendorDir = $vendorDir;
109
+ }
110
+
111
+ /**
112
+ * @return string[]
113
+ */
114
  public function getPrefixes()
115
  {
116
  if (!empty($this->prefixesPsr0)) {
120
  return array();
121
  }
122
 
123
+ /**
124
+ * @return array[]
125
+ * @psalm-return array<string, array<int, string>>
126
+ */
127
  public function getPrefixesPsr4()
128
  {
129
  return $this->prefixDirsPsr4;
130
  }
131
 
132
+ /**
133
+ * @return array[]
134
+ * @psalm-return array<string, string>
135
+ */
136
  public function getFallbackDirs()
137
  {
138
  return $this->fallbackDirsPsr0;
139
  }
140
 
141
+ /**
142
+ * @return array[]
143
+ * @psalm-return array<string, string>
144
+ */
145
  public function getFallbackDirsPsr4()
146
  {
147
  return $this->fallbackDirsPsr4;
148
  }
149
 
150
+ /**
151
+ * @return string[] Array of classname => path
152
+ * @psalm-return array<string, string>
153
+ */
154
  public function getClassMap()
155
  {
156
  return $this->classMap;
157
  }
158
 
159
  /**
160
+ * @param string[] $classMap Class to filename map
161
+ * @psalm-param array<string, string> $classMap
162
+ *
163
+ * @return void
164
  */
165
  public function addClassMap(array $classMap)
166
  {
175
  * Registers a set of PSR-0 directories for a given prefix, either
176
  * appending or prepending to the ones previously set for this prefix.
177
  *
178
+ * @param string $prefix The prefix
179
+ * @param string[]|string $paths The PSR-0 root directories
180
+ * @param bool $prepend Whether to prepend the directories
181
+ *
182
+ * @return void
183
  */
184
  public function add($prefix, $paths, $prepend = false)
185
  {
222
  * Registers a set of PSR-4 directories for a given namespace, either
223
  * appending or prepending to the ones previously set for this namespace.
224
  *
225
+ * @param string $prefix The prefix/namespace, with trailing '\\'
226
+ * @param string[]|string $paths The PSR-4 base directories
227
+ * @param bool $prepend Whether to prepend the directories
228
  *
229
  * @throws \InvalidArgumentException
230
+ *
231
+ * @return void
232
  */
233
  public function addPsr4($prefix, $paths, $prepend = false)
234
  {
272
  * Registers a set of PSR-0 directories for a given prefix,
273
  * replacing any others previously set for this prefix.
274
  *
275
+ * @param string $prefix The prefix
276
+ * @param string[]|string $paths The PSR-0 base directories
277
+ *
278
+ * @return void
279
  */
280
  public function set($prefix, $paths)
281
  {
290
  * Registers a set of PSR-4 directories for a given namespace,
291
  * replacing any others previously set for this namespace.
292
  *
293
+ * @param string $prefix The prefix/namespace, with trailing '\\'
294
+ * @param string[]|string $paths The PSR-4 base directories
295
  *
296
  * @throws \InvalidArgumentException
297
+ *
298
+ * @return void
299
  */
300
  public function setPsr4($prefix, $paths)
301
  {
315
  * Turns on searching the include path for class files.
316
  *
317
  * @param bool $useIncludePath
318
+ *
319
+ * @return void
320
  */
321
  public function setUseIncludePath($useIncludePath)
322
  {
339
  * that have not been registered with the class map.
340
  *
341
  * @param bool $classMapAuthoritative
342
+ *
343
+ * @return void
344
  */
345
  public function setClassMapAuthoritative($classMapAuthoritative)
346
  {
361
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
362
  *
363
  * @param string|null $apcuPrefix
364
+ *
365
+ * @return void
366
  */
367
  public function setApcuPrefix($apcuPrefix)
368
  {
383
  * Registers this instance as an autoloader.
384
  *
385
  * @param bool $prepend Whether to prepend the autoloader or not
386
+ *
387
+ * @return void
388
  */
389
  public function register($prepend = false)
390
  {
391
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392
+
393
+ if (null === $this->vendorDir) {
394
+ return;
395
+ }
396
+
397
+ if ($prepend) {
398
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399
+ } else {
400
+ unset(self::$registeredLoaders[$this->vendorDir]);
401
+ self::$registeredLoaders[$this->vendorDir] = $this;
402
+ }
403
  }
404
 
405
  /**
406
  * Unregisters this instance as an autoloader.
407
+ *
408
+ * @return void
409
  */
410
  public function unregister()
411
  {
412
  spl_autoload_unregister(array($this, 'loadClass'));
413
+
414
+ if (null !== $this->vendorDir) {
415
+ unset(self::$registeredLoaders[$this->vendorDir]);
416
+ }
417
  }
418
 
419
  /**
420
  * Loads the given class or interface.
421
  *
422
  * @param string $class The name of the class
423
+ * @return true|null True if loaded, null otherwise
424
  */
425
  public function loadClass($class)
426
  {
429
 
430
  return true;
431
  }
432
+
433
+ return null;
434
  }
435
 
436
  /**
475
  return $file;
476
  }
477
 
478
+ /**
479
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
480
+ *
481
+ * @return self[]
482
+ */
483
+ public static function getRegisteredLoaders()
484
+ {
485
+ return self::$registeredLoaders;
486
+ }
487
+
488
+ /**
489
+ * @param string $class
490
+ * @param string $ext
491
+ * @return string|false
492
+ */
493
  private function findFileWithExtension($class, $ext)
494
  {
495
  // PSR-4 lookup
561
  * Scope isolated include.
562
  *
563
  * Prevents access to $this/self from included files.
564
+ *
565
+ * @param string $file
566
+ * @return void
567
+ * @private
568
  */
569
  function includeFile($file)
570
  {
vendor/composer/InstalledVersions.php CHANGED
@@ -21,11 +21,26 @@ use Composer\Semver\VersionParser;
21
  * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
22
  *
23
  * To require its presence, you can require `composer-runtime-api ^2.0`
 
 
24
  */
25
  class InstalledVersions
26
  {
 
 
 
 
27
  private static $installed;
 
 
 
 
28
  private static $canGetVendors;
 
 
 
 
 
29
  private static $installedByVendor = array();
30
 
31
  /**
21
  * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
22
  *
23
  * To require its presence, you can require `composer-runtime-api ^2.0`
24
+ *
25
+ * @final
26
  */
27
  class InstalledVersions
28
  {
29
+ /**
30
+ * @var mixed[]|null
31
+ * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
32
+ */
33
  private static $installed;
34
+
35
+ /**
36
+ * @var bool|null
37
+ */
38
  private static $canGetVendors;
39
+
40
+ /**
41
+ * @var array[]
42
+ * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
43
+ */
44
  private static $installedByVendor = array();
45
 
46
  /**
vendor/composer/autoload_classmap.php CHANGED
@@ -2,9 +2,10 @@
2
 
3
  // autoload_classmap.php @generated by Composer
4
 
5
- $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  'PAnD' => $vendorDir . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
10
  );
2
 
3
  // autoload_classmap.php @generated by Composer
4
 
5
+ $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
  'PAnD' => $vendorDir . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
11
  );
vendor/composer/autoload_namespaces.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_namespaces.php @generated by Composer
4
 
5
- $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
2
 
3
  // autoload_namespaces.php @generated by Composer
4
 
5
+ $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
vendor/composer/autoload_psr4.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_psr4.php @generated by Composer
4
 
5
- $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
2
 
3
  // autoload_psr4.php @generated by Composer
4
 
5
+ $vendorDir = dirname(__DIR__);
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
vendor/composer/autoload_real.php CHANGED
@@ -22,31 +22,14 @@ class ComposerAutoloaderInit011b69449cca0613a375d6d6d222097e
22
  return self::$loader;
23
  }
24
 
 
 
25
  spl_autoload_register(array('ComposerAutoloaderInit011b69449cca0613a375d6d6d222097e', 'loadClassLoader'), true, true);
26
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
  spl_autoload_unregister(array('ComposerAutoloaderInit011b69449cca0613a375d6d6d222097e', 'loadClassLoader'));
28
 
29
- $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
- if ($useStaticLoader) {
31
- require_once __DIR__ . '/autoload_static.php';
32
-
33
- call_user_func(\Composer\Autoload\ComposerStaticInit011b69449cca0613a375d6d6d222097e::getInitializer($loader));
34
- } else {
35
- $map = require __DIR__ . '/autoload_namespaces.php';
36
- foreach ($map as $namespace => $path) {
37
- $loader->set($namespace, $path);
38
- }
39
-
40
- $map = require __DIR__ . '/autoload_psr4.php';
41
- foreach ($map as $namespace => $path) {
42
- $loader->setPsr4($namespace, $path);
43
- }
44
-
45
- $classMap = require __DIR__ . '/autoload_classmap.php';
46
- if ($classMap) {
47
- $loader->addClassMap($classMap);
48
- }
49
- }
50
 
51
  $loader->register(true);
52
 
22
  return self::$loader;
23
  }
24
 
25
+ require __DIR__ . '/platform_check.php';
26
+
27
  spl_autoload_register(array('ComposerAutoloaderInit011b69449cca0613a375d6d6d222097e', 'loadClassLoader'), true, true);
28
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
  spl_autoload_unregister(array('ComposerAutoloaderInit011b69449cca0613a375d6d6d222097e', 'loadClassLoader'));
30
 
31
+ require __DIR__ . '/autoload_static.php';
32
+ call_user_func(\Composer\Autoload\ComposerStaticInit011b69449cca0613a375d6d6d222097e::getInitializer($loader));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  $loader->register(true);
35
 
vendor/composer/autoload_static.php CHANGED
@@ -7,6 +7,7 @@ namespace Composer\Autoload;
7
  class ComposerStaticInit011b69449cca0613a375d6d6d222097e
8
  {
9
  public static $classMap = array (
 
10
  'PAnD' => __DIR__ . '/..' . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
11
  );
12
 
7
  class ComposerStaticInit011b69449cca0613a375d6d6d222097e
8
  {
9
  public static $classMap = array (
10
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
11
  'PAnD' => __DIR__ . '/..' . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
12
  );
13
 
vendor/composer/installed.json CHANGED
@@ -1,41 +1,46 @@
1
- [
2
- {
3
- "name": "collizo4sky/persist-admin-notices-dismissal",
4
- "version": "1.4.4",
5
- "version_normalized": "1.4.4.0",
6
- "source": {
7
- "type": "git",
8
- "url": "https://github.com/w3guy/persist-admin-notices-dismissal.git",
9
- "reference": "900739eb6b0ec0210465f5983a6d4e0e420289e4"
10
- },
11
- "dist": {
12
- "type": "zip",
13
- "url": "https://api.github.com/repos/w3guy/persist-admin-notices-dismissal/zipball/900739eb6b0ec0210465f5983a6d4e0e420289e4",
14
- "reference": "900739eb6b0ec0210465f5983a6d4e0e420289e4",
15
- "shasum": ""
16
- },
17
- "require": {
18
- "php": ">=5.4"
19
- },
20
- "time": "2020-12-31T17:12:37+00:00",
21
- "type": "library",
22
- "installation-source": "source",
23
- "autoload": {
24
- "classmap": [
25
- "persist-admin-notices-dismissal.php"
26
- ]
27
- },
28
- "notification-url": "https://packagist.org/downloads/",
29
- "license": [
30
- "GPL-3.0-or-later"
31
- ],
32
- "authors": [
33
- {
34
- "name": "Collins Agbonghama",
35
- "email": "me@w3guy.com",
36
- "role": "developer"
37
- }
38
- ],
39
- "description": "Simple library to persist dismissal of admin notices across pages in WordPress dashboard."
40
- }
41
- ]
 
 
 
 
 
1
+ {
2
+ "packages": [
3
+ {
4
+ "name": "collizo4sky/persist-admin-notices-dismissal",
5
+ "version": "1.4.4",
6
+ "version_normalized": "1.4.4.0",
7
+ "source": {
8
+ "type": "git",
9
+ "url": "https://github.com/w3guy/persist-admin-notices-dismissal.git",
10
+ "reference": "900739eb6b0ec0210465f5983a6d4e0e420289e4"
11
+ },
12
+ "dist": {
13
+ "type": "zip",
14
+ "url": "https://api.github.com/repos/w3guy/persist-admin-notices-dismissal/zipball/900739eb6b0ec0210465f5983a6d4e0e420289e4",
15
+ "reference": "900739eb6b0ec0210465f5983a6d4e0e420289e4",
16
+ "shasum": ""
17
+ },
18
+ "require": {
19
+ "php": ">=5.4"
20
+ },
21
+ "time": "2020-12-31T17:12:37+00:00",
22
+ "type": "library",
23
+ "installation-source": "source",
24
+ "autoload": {
25
+ "classmap": [
26
+ "persist-admin-notices-dismissal.php"
27
+ ]
28
+ },
29
+ "notification-url": "https://packagist.org/downloads/",
30
+ "license": [
31
+ "GPL-3.0-or-later"
32
+ ],
33
+ "authors": [
34
+ {
35
+ "name": "Collins Agbonghama",
36
+ "email": "me@w3guy.com",
37
+ "role": "developer"
38
+ }
39
+ ],
40
+ "description": "Simple library to persist dismissal of admin notices across pages in WordPress dashboard.",
41
+ "install-path": "../collizo4sky/persist-admin-notices-dismissal"
42
+ }
43
+ ],
44
+ "dev": false,
45
+ "dev-package-names": []
46
+ }
vendor/composer/installed.php CHANGED
@@ -5,7 +5,7 @@
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => '5977d44b5bdb5c3ebf7afa6fda7f4846decd8c0e',
9
  'name' => '__root__',
10
  'dev' => false,
11
  ),
@@ -16,7 +16,7 @@
16
  'type' => 'library',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => '5977d44b5bdb5c3ebf7afa6fda7f4846decd8c0e',
20
  'dev_requirement' => false,
21
  ),
22
  'collizo4sky/persist-admin-notices-dismissal' => array(
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => 'c3a3fe4d9434d01ad6c5bcdedb5668faec7521e4',
9
  'name' => '__root__',
10
  'dev' => false,
11
  ),
16
  'type' => 'library',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => 'c3a3fe4d9434d01ad6c5bcdedb5668faec7521e4',
20
  'dev_requirement' => false,
21
  ),
22
  'collizo4sky/persist-admin-notices-dismissal' => array(