wp-sweep
Last commit date
inc
3 years ago
js
9 years ago
CLAUDE.md
1 month ago
admin.php
7 years ago
composer.json
6 years ago
composer.lock
6 years ago
index.php
7 years ago
readme.txt
1 month ago
uninstall.php
7 years ago
wp-sweep.php
1 month ago
admin.php
583 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WP-Sweep admin.php |
| 4 | * |
| 5 | * @package wp-sweep |
| 6 | */ |
| 7 | |
| 8 | // Exit if accessed directly. |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | // Variables. |
| 14 | $current_page = admin_url( 'tools.php?page=' . plugin_basename( 'wp-sweep/admin.php' ) ); |
| 15 | $message = ''; |
| 16 | |
| 17 | // Sweeping. |
| 18 | if ( ! empty( $_GET['sweep'] ) ) { |
| 19 | if ( check_admin_referer( 'wp_sweep_' . $_GET['sweep'] ) ) { |
| 20 | $message = WPSweep::get_instance()->sweep( $_GET['sweep'] ); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | // Database Table Status. |
| 25 | $total_posts = WPSweep::get_instance()->total_count( 'posts' ); |
| 26 | $total_postmeta = WPSweep::get_instance()->total_count( 'postmeta' ); |
| 27 | $total_comments = WPSweep::get_instance()->total_count( 'comments' ); |
| 28 | $total_commentmeta = WPSweep::get_instance()->total_count( 'commentmeta' ); |
| 29 | $total_users = WPSweep::get_instance()->total_count( 'users' ); |
| 30 | $total_usermeta = WPSweep::get_instance()->total_count( 'usermeta' ); |
| 31 | $total_term_relationships = WPSweep::get_instance()->total_count( 'term_relationships' ); |
| 32 | $total_term_taxonomy = WPSweep::get_instance()->total_count( 'term_taxonomy' ); |
| 33 | $total_terms = WPSweep::get_instance()->total_count( 'terms' ); |
| 34 | $total_termmeta = WPSweep::get_instance()->total_count( 'termmeta' ); |
| 35 | $total_options = WPSweep::get_instance()->total_count( 'options' ); |
| 36 | $total_tables = WPSweep::get_instance()->total_count( 'tables' ); |
| 37 | |
| 38 | // Count. |
| 39 | $revisions = WPSweep::get_instance()->count( 'revisions' ); |
| 40 | $auto_drafts = WPSweep::get_instance()->count( 'auto_drafts' ); |
| 41 | $deleted_posts = WPSweep::get_instance()->count( 'deleted_posts' ); |
| 42 | $orphan_postmeta = WPSweep::get_instance()->count( 'orphan_postmeta' ); |
| 43 | $duplicated_postmeta = WPSweep::get_instance()->count( 'duplicated_postmeta' ); |
| 44 | $oembed_postmeta = WPSweep::get_instance()->count( 'oembed_postmeta' ); |
| 45 | |
| 46 | $unapproved_comments = WPSweep::get_instance()->count( 'unapproved_comments' ); |
| 47 | $spam_comments = WPSweep::get_instance()->count( 'spam_comments' ); |
| 48 | $deleted_comments = WPSweep::get_instance()->count( 'deleted_comments' ); |
| 49 | $orphan_commentmeta = WPSweep::get_instance()->count( 'orphan_commentmeta' ); |
| 50 | $duplicated_commentmeta = WPSweep::get_instance()->count( 'duplicated_commentmeta' ); |
| 51 | |
| 52 | $orphan_usermeta = WPSweep::get_instance()->count( 'orphan_usermeta' ); |
| 53 | $duplicated_usermeta = WPSweep::get_instance()->count( 'duplicated_usermeta' ); |
| 54 | |
| 55 | $orphan_term_relationships = WPSweep::get_instance()->count( 'orphan_term_relationships' ); |
| 56 | $unused_terms = WPSweep::get_instance()->count( 'unused_terms' ); |
| 57 | $orphan_termmeta = WPSweep::get_instance()->count( 'orphan_termmeta' ); |
| 58 | $duplicated_termmeta = WPSweep::get_instance()->count( 'duplicated_termmeta' ); |
| 59 | |
| 60 | $transient_options = WPSweep::get_instance()->count( 'transient_options' ); |
| 61 | |
| 62 | ?> |
| 63 | <style type="text/css"> |
| 64 | .table-sweep thead th { |
| 65 | width: 12%; |
| 66 | } |
| 67 | .table-sweep thead th.col-sweep-details { |
| 68 | width: 56%; |
| 69 | } |
| 70 | .table-sweep thead th.col-sweep-action { |
| 71 | width: 20%; |
| 72 | } |
| 73 | </style> |
| 74 | <div class="wrap"> |
| 75 | <h2><?php esc_html_e( 'WP-Sweep', 'wp-sweep' ); ?></h2> |
| 76 | <div class="notice notice-warning"> |
| 77 | <p> |
| 78 | <?php /* translators: %1 WP-DBManager Plugin URL, %2 _blank to open new window */ ?> |
| 79 | <?php echo wp_kses_post( sprintf( __( 'Before you do any sweep, please <a href="%1$s" target="%2$s">backup your database</a> first because any sweep done is irreversible.', 'wp-sweep' ), 'https://wordpress.org/plugins/wp-dbmanager/', '_blank' ) ); ?> |
| 80 | </p> |
| 81 | </div> |
| 82 | <p> |
| 83 | <?php /* translators: %s maximum number of results */ ?> |
| 84 | <?php echo esc_html( sprintf( __( 'For performance reasons, only %s items will be shown if you click Details.', 'wp-sweep' ), number_format_i18n( WPSweep::get_instance()->limit_details ) ) ); ?> |
| 85 | </p> |
| 86 | <h3><?php esc_html_e( 'Post Sweep', 'wp-sweep' ); ?></h3> |
| 87 | <?php /* translators: %1 is the number of posts, %2 is the number of post meta */ ?> |
| 88 | <p><?php echo wp_kses_post( sprintf( __( 'There are a total of <strong class="attention"><span class="sweep-count-type-posts">%1$s</span> Posts</strong> and <strong class="attention"><span class="sweep-count-type-postmeta">%2$s</span> Post Meta</strong>.', 'wp-sweep' ), number_format_i18n( $total_posts ), number_format_i18n( $total_postmeta ) ) ); ?></p> |
| 89 | <div class="sweep-message"></div> |
| 90 | <table class="widefat table-sweep"> |
| 91 | <thead> |
| 92 | <tr> |
| 93 | <th class="col-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></th> |
| 94 | <th class="col-sweep-count"><?php esc_html_e( 'Count', 'wp-sweep' ); ?></th> |
| 95 | <th class="col-sweep-percent"><?php esc_html_e( '% Of', 'wp-sweep' ); ?></th> |
| 96 | <th class="col-sweep-action"><?php esc_html_e( 'Action', 'wp-sweep' ); ?></th> |
| 97 | </tr> |
| 98 | </thead> |
| 99 | <tbody> |
| 100 | <tr> |
| 101 | <td> |
| 102 | <strong><?php esc_html_e( 'Revisions', 'wp-sweep' ); ?></strong> |
| 103 | <p class="sweep-details" style="display: none;"></p> |
| 104 | </td> |
| 105 | <td> |
| 106 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $revisions ) ); ?></span> |
| 107 | </td> |
| 108 | <td> |
| 109 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $revisions, $total_posts ) ); ?></span> |
| 110 | </td> |
| 111 | <td> |
| 112 | <?php if ( ! empty( $revisions ) ) : ?> |
| 113 | <button data-action="sweep" data-sweep_name="revisions" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_revisions' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 114 | <button data-action="sweep_details" data-sweep_name="revisions" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_revisions' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 115 | <?php else : ?> |
| 116 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 117 | <?php endif; ?> |
| 118 | </td> |
| 119 | </tr> |
| 120 | <tr class="alternate"> |
| 121 | <td> |
| 122 | <strong><?php esc_html_e( 'Auto Drafts', 'wp-sweep' ); ?></strong> |
| 123 | <p class="sweep-details" style="display: none;"></p> |
| 124 | </td> |
| 125 | <td> |
| 126 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $auto_drafts ) ); ?></span> |
| 127 | </td> |
| 128 | <td> |
| 129 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $auto_drafts, $total_posts ) ); ?></span> |
| 130 | </td> |
| 131 | <td> |
| 132 | <?php if ( ! empty( $auto_drafts ) ) : ?> |
| 133 | <button data-action="sweep" data-sweep_name="auto_drafts" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_auto_drafts' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 134 | <button data-action="sweep_details" data-sweep_name="auto_drafts" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_auto_drafts' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 135 | <?php else : ?> |
| 136 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 137 | <?php endif; ?> |
| 138 | </td> |
| 139 | </tr> |
| 140 | <tr> |
| 141 | <td> |
| 142 | <strong><?php esc_html_e( 'Deleted Posts', 'wp-sweep' ); ?></strong> |
| 143 | <p class="sweep-details" style="display: none;"></p> |
| 144 | </td> |
| 145 | <td> |
| 146 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $deleted_posts ) ); ?></span> |
| 147 | </td> |
| 148 | <td> |
| 149 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $deleted_posts, $total_posts ) ); ?></span> |
| 150 | </td> |
| 151 | <td> |
| 152 | <?php if ( ! empty( $deleted_posts ) ) : ?> |
| 153 | <button data-action="sweep" data-sweep_name="deleted_posts" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_deleted_posts' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 154 | <button data-action="sweep_details" data-sweep_name="deleted_posts" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_deleted_posts' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 155 | <?php else : ?> |
| 156 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 157 | <?php endif; ?> |
| 158 | </td> |
| 159 | </tr> |
| 160 | <tr class="alternate"> |
| 161 | <td> |
| 162 | <strong><?php esc_html_e( 'Orphaned Post Meta', 'wp-sweep' ); ?></strong> |
| 163 | <p class="sweep-details" style="display: none;"></p> |
| 164 | </td> |
| 165 | <td> |
| 166 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $orphan_postmeta ) ); ?></span> |
| 167 | </td> |
| 168 | <td> |
| 169 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $orphan_postmeta, $total_postmeta ) ); ?></span> |
| 170 | </td> |
| 171 | <td> |
| 172 | <?php if ( ! empty( $orphan_postmeta ) ) : ?> |
| 173 | <button data-action="sweep" data-sweep_name="orphan_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_orphan_postmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 174 | <button data-action="sweep_details" data-sweep_name="orphan_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_orphan_postmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 175 | <?php else : ?> |
| 176 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 177 | <?php endif; ?> |
| 178 | </td> |
| 179 | </tr> |
| 180 | <tr> |
| 181 | <td> |
| 182 | <strong><?php esc_html_e( 'Duplicated Post Meta', 'wp-sweep' ); ?></strong> |
| 183 | <p class="sweep-details" style="display: none;"></p> |
| 184 | </td> |
| 185 | <td> |
| 186 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $duplicated_postmeta ) ); ?></span> |
| 187 | </td> |
| 188 | <td> |
| 189 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $duplicated_postmeta, $total_postmeta ) ); ?></span> |
| 190 | </td> |
| 191 | <td> |
| 192 | <?php if ( ! empty( $duplicated_postmeta ) ) : ?> |
| 193 | <button data-action="sweep" data-sweep_name="duplicated_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_duplicated_postmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 194 | <button data-action="sweep_details" data-sweep_name="duplicated_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_duplicated_postmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 195 | <?php else : ?> |
| 196 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 197 | <?php endif; ?> |
| 198 | </td> |
| 199 | </tr> |
| 200 | <tr class="alternate"> |
| 201 | <td> |
| 202 | <strong><?php esc_html_e( 'oEmbed Caches In Post Meta', 'wp-sweep' ); ?></strong> |
| 203 | <p class="sweep-details" style="display: none;"></p> |
| 204 | </td> |
| 205 | <td> |
| 206 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $oembed_postmeta ) ); ?></span> |
| 207 | </td> |
| 208 | <td> |
| 209 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $oembed_postmeta, $total_postmeta ) ); ?></span> |
| 210 | </td> |
| 211 | <td> |
| 212 | <?php if ( ! empty( $oembed_postmeta ) ) : ?> |
| 213 | <button data-action="sweep" data-sweep_name="oembed_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_oembed_postmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 214 | <button data-action="sweep_details" data-sweep_name="oembed_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_oembed_postmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 215 | <?php else : ?> |
| 216 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 217 | <?php endif; ?> |
| 218 | </td> |
| 219 | </tr> |
| 220 | </tbody> |
| 221 | </table> |
| 222 | <?php do_action( 'wp_sweep_admin_post_sweep' ); ?> |
| 223 | <p> </p> |
| 224 | <h3><?php esc_html_e( 'Comment Sweep', 'wp-sweep' ); ?></h3> |
| 225 | <?php /* translators: %1 is the number of comments, %2 is the number of comment meta */ ?> |
| 226 | <p><?php echo wp_kses_post( sprintf( __( 'There are a total of <strong class="attention"><span class="sweep-count-type-comments">%1$s</span> Comments</strong> and <strong class="attention"><span class="sweep-count-type-commentmeta">%2$s</span> Comment Meta</strong>.', 'wp-sweep' ), number_format_i18n( $total_comments ), number_format_i18n( $total_commentmeta ) ) ); ?></p> |
| 227 | <div class="sweep-message"></div> |
| 228 | <table class="widefat table-sweep"> |
| 229 | <thead> |
| 230 | <tr> |
| 231 | <th class="col-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></th> |
| 232 | <th class="col-sweep-count"><?php esc_html_e( 'Count', 'wp-sweep' ); ?></th> |
| 233 | <th class="col-sweep-percent"><?php esc_html_e( '% Of', 'wp-sweep' ); ?></th> |
| 234 | <th class="col-sweep-action"><?php esc_html_e( 'Action', 'wp-sweep' ); ?></th> |
| 235 | </tr> |
| 236 | </thead> |
| 237 | <tbody> |
| 238 | <tr> |
| 239 | <td> |
| 240 | <strong><?php esc_html_e( 'Unapproved Comments', 'wp-sweep' ); ?></strong> |
| 241 | <p class="sweep-details" style="display: none;"></p> |
| 242 | </td> |
| 243 | <td> |
| 244 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $unapproved_comments ) ); ?></span> |
| 245 | </td> |
| 246 | <td> |
| 247 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $unapproved_comments, $total_comments ) ); ?></span> |
| 248 | </td> |
| 249 | <td> |
| 250 | <?php if ( ! empty( $unapproved_comments ) ) : ?> |
| 251 | <button data-action="sweep" data-sweep_name="unapproved_comments" data-sweep_type="comments" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_unapproved_comments' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 252 | <button data-action="sweep_details" data-sweep_name="unapproved_comments" data-sweep_type="comments" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_unapproved_comments' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 253 | <?php else : ?> |
| 254 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 255 | <?php endif; ?> |
| 256 | </td> |
| 257 | </tr> |
| 258 | <tr class="alternate"> |
| 259 | <td> |
| 260 | <strong><?php esc_html_e( 'Spammed Comments', 'wp-sweep' ); ?></strong> |
| 261 | <p class="sweep-details" style="display: none;"></p> |
| 262 | </td> |
| 263 | <td> |
| 264 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $spam_comments ) ); ?></span> |
| 265 | </td> |
| 266 | <td> |
| 267 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $spam_comments, $total_comments ) ); ?></span> |
| 268 | </td> |
| 269 | <td> |
| 270 | <?php if ( ! empty( $spam_comments ) ) : ?> |
| 271 | <button data-action="sweep" data-sweep_name="spam_comments" data-sweep_type="comments" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_spam_comments' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 272 | <button data-action="sweep_details" data-sweep_name="spam_comments" data-sweep_type="comments" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_spam_comments' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 273 | <?php else : ?> |
| 274 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 275 | <?php endif; ?> |
| 276 | </td> |
| 277 | </tr> |
| 278 | <tr> |
| 279 | <td> |
| 280 | <strong><?php esc_html_e( 'Deleted Comments', 'wp-sweep' ); ?></strong> |
| 281 | <p class="sweep-details" style="display: none;"></p> |
| 282 | </td> |
| 283 | <td> |
| 284 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $deleted_comments ) ); ?></span> |
| 285 | </td> |
| 286 | <td> |
| 287 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $deleted_comments, $total_comments ) ); ?></span> |
| 288 | </td> |
| 289 | <td> |
| 290 | <?php if ( ! empty( $deleted_comments ) ) : ?> |
| 291 | <button data-action="sweep" data-sweep_name="deleted_comments" data-sweep_type="comments" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_deleted_comments' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 292 | <button data-action="sweep_details" data-sweep_name="deleted_comments" data-sweep_type="comments" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_deleted_comments' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 293 | <?php else : ?> |
| 294 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 295 | <?php endif; ?> |
| 296 | </td> |
| 297 | </tr> |
| 298 | <tr class="alternate"> |
| 299 | <td> |
| 300 | <strong><?php esc_html_e( 'Orphaned Comment Meta', 'wp-sweep' ); ?></strong> |
| 301 | <p class="sweep-details" style="display: none;"></p> |
| 302 | </td> |
| 303 | <td> |
| 304 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $orphan_commentmeta ) ); ?></span> |
| 305 | </td> |
| 306 | <td> |
| 307 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $orphan_commentmeta, $total_commentmeta ) ); ?></span> |
| 308 | </td> |
| 309 | <td> |
| 310 | <?php if ( ! empty( $orphan_commentmeta ) ) : ?> |
| 311 | <button data-action="sweep" data-sweep_name="orphan_commentmeta" data-sweep_type="commentmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_orphan_commentmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 312 | <button data-action="sweep_details" data-sweep_name="orphan_commentmeta" data-sweep_type="commentmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_orphan_commentmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 313 | <?php else : ?> |
| 314 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 315 | <?php endif; ?> |
| 316 | </td> |
| 317 | </tr> |
| 318 | <tr> |
| 319 | <td> |
| 320 | <strong><?php esc_html_e( 'Duplicated Comment Meta', 'wp-sweep' ); ?></strong> |
| 321 | <p class="sweep-details" style="display: none;"></p> |
| 322 | </td> |
| 323 | <td> |
| 324 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $duplicated_commentmeta ) ); ?></span> |
| 325 | </td> |
| 326 | <td> |
| 327 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $duplicated_commentmeta, $total_commentmeta ) ); ?></span> |
| 328 | </td> |
| 329 | <td> |
| 330 | <?php if ( ! empty( $duplicated_commentmeta ) ) : ?> |
| 331 | <button data-action="sweep" data-sweep_name="duplicated_commentmeta" data-sweep_type="commentmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_duplicated_commentmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 332 | <button data-action="sweep_details" data-sweep_name="duplicated_commentmeta" data-sweep_type="commentmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_duplicated_commentmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 333 | <?php else : ?> |
| 334 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 335 | <?php endif; ?> |
| 336 | </td> |
| 337 | </tr> |
| 338 | </tbody> |
| 339 | </table> |
| 340 | <?php do_action( 'wp_sweep_admin_comment_sweep' ); ?> |
| 341 | <p> </p> |
| 342 | <h3><?php esc_html_e( 'User Sweep', 'wp-sweep' ); ?></h3> |
| 343 | <?php /* translators: %1 is the number of users, %2 is the number of user meta */ ?> |
| 344 | <p><?php echo wp_kses_post( sprintf( __( 'There are a total of <strong class="attention"><span class="sweep-count-type-users">%1$s</span> Users</strong> and <strong class="attention"><span class="sweep-count-type-usermeta">%2$s</span> User Meta</strong>.', 'wp-sweep' ), number_format_i18n( $total_users ), number_format_i18n( $total_usermeta ) ) ); ?></p> |
| 345 | <div class="sweep-message"></div> |
| 346 | <table class="widefat table-sweep"> |
| 347 | <thead> |
| 348 | <tr> |
| 349 | <th class="col-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></th> |
| 350 | <th class="col-sweep-count"><?php esc_html_e( 'Count', 'wp-sweep' ); ?></th> |
| 351 | <th class="col-sweep-percent"><?php esc_html_e( '% Of', 'wp-sweep' ); ?></th> |
| 352 | <th class="col-sweep-action"><?php esc_html_e( 'Action', 'wp-sweep' ); ?></th> |
| 353 | </tr> |
| 354 | </thead> |
| 355 | <tbody> |
| 356 | <tr> |
| 357 | <td> |
| 358 | <strong><?php esc_html_e( 'Orphaned User Meta', 'wp-sweep' ); ?></strong> |
| 359 | <p class="sweep-details" style="display: none;"></p> |
| 360 | </td> |
| 361 | <td> |
| 362 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $orphan_usermeta ) ); ?></span> |
| 363 | </td> |
| 364 | <td> |
| 365 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $orphan_usermeta, $total_usermeta ) ); ?></span> |
| 366 | </td> |
| 367 | <td> |
| 368 | <?php if ( ! empty( $orphan_usermeta ) ) : ?> |
| 369 | <button data-action="sweep" data-sweep_name="orphan_usermeta" data-sweep_type="usermeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_orphan_usermeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 370 | <button data-action="sweep_details" data-sweep_name="orphan_usermeta" data-sweep_type="usermeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_orphan_usermeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 371 | <?php else : ?> |
| 372 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 373 | <?php endif; ?> |
| 374 | </td> |
| 375 | </tr> |
| 376 | <tr class="alternate"> |
| 377 | <td> |
| 378 | <strong><?php esc_html_e( 'Duplicated User Meta', 'wp-sweep' ); ?></strong> |
| 379 | <p class="sweep-details" style="display: none;"></p> |
| 380 | </td> |
| 381 | <td> |
| 382 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $duplicated_usermeta ) ); ?></span> |
| 383 | </td> |
| 384 | <td> |
| 385 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $duplicated_usermeta, $total_usermeta ) ); ?></span> |
| 386 | </td> |
| 387 | <td> |
| 388 | <?php if ( ! empty( $duplicated_usermeta ) ) : ?> |
| 389 | <button data-action="sweep" data-sweep_name="duplicated_usermeta" data-sweep_type="usermeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_duplicated_usermeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 390 | <button data-action="sweep_details" data-sweep_name="duplicated_usermeta" data-sweep_type="usermeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_duplicated_usermeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 391 | <?php else : ?> |
| 392 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 393 | <?php endif; ?> |
| 394 | </td> |
| 395 | </tr> |
| 396 | </tbody> |
| 397 | </table> |
| 398 | <?php do_action( 'wp_sweep_admin_user_sweep' ); ?> |
| 399 | <p> </p> |
| 400 | <h3><?php esc_html_e( 'Term Sweep', 'wp-sweep' ); ?></h3> |
| 401 | <?php /* translators: %1 is the number of terms, %2 is the number of term meta */ ?> |
| 402 | <p><?php echo wp_kses_post( sprintf( __( 'There are a total of <strong class="attention "><span class="sweep-count-type-terms">%1$s</span> Terms</strong>, <strong class="attention "><span class="sweep-count-type-termmeta">%2$s</span> Term Meta</strong>, <strong class="attention"><span class="sweep-count-type-term_taxonomy">%3$s</span> Term Taxonomy</strong> and <strong class="attention"><span class="sweep-count-type-term_relationships">%4$s</span> Term Relationships</strong>.', 'wp-sweep' ), number_format_i18n( $total_terms ), number_format_i18n( $total_termmeta ), number_format_i18n( $total_term_taxonomy ), number_format_i18n( $total_term_relationships ) ) ); ?></p> |
| 403 | <div class="sweep-message"></div> |
| 404 | <table class="widefat table-sweep"> |
| 405 | <thead> |
| 406 | <tr> |
| 407 | <th class="col-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></th> |
| 408 | <th class="col-sweep-count"><?php esc_html_e( 'Count', 'wp-sweep' ); ?></th> |
| 409 | <th class="col-sweep-percent"><?php esc_html_e( '% Of', 'wp-sweep' ); ?></th> |
| 410 | <th class="col-sweep-action"><?php esc_html_e( 'Action', 'wp-sweep' ); ?></th> |
| 411 | </tr> |
| 412 | </thead> |
| 413 | <tbody> |
| 414 | <tr> |
| 415 | <td> |
| 416 | <strong><?php esc_html_e( 'Orphaned Term Meta', 'wp-sweep' ); ?></strong> |
| 417 | <p class="sweep-details" style="display: none;"></p> |
| 418 | </td> |
| 419 | <td> |
| 420 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $orphan_termmeta ) ); ?></span> |
| 421 | </td> |
| 422 | <td> |
| 423 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $orphan_termmeta, $total_termmeta ) ); ?></span> |
| 424 | </td> |
| 425 | <td> |
| 426 | <?php if ( ! empty( $orphan_termmeta ) ) : ?> |
| 427 | <button data-action="sweep" data-sweep_name="orphan_termmeta" data-sweep_type="termmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_orphan_termmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 428 | <button data-action="sweep_details" data-sweep_name="orphan_termmeta" data-sweep_type="termmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_orphan_termmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 429 | <?php else : ?> |
| 430 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 431 | <?php endif; ?> |
| 432 | </td> |
| 433 | </tr> |
| 434 | <tr class="alternate"> |
| 435 | <td> |
| 436 | <strong><?php esc_html_e( 'Duplicated Term Meta', 'wp-sweep' ); ?></strong> |
| 437 | <p class="sweep-details" style="display: none;"></p> |
| 438 | </td> |
| 439 | <td> |
| 440 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $duplicated_termmeta ) ); ?></span> |
| 441 | </td> |
| 442 | <td> |
| 443 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $duplicated_termmeta, $total_termmeta ) ); ?></span> |
| 444 | </td> |
| 445 | <td> |
| 446 | <?php if ( ! empty( $duplicated_termmeta ) ) : ?> |
| 447 | <button data-action="sweep" data-sweep_name="duplicated_termmeta" data-sweep_type="termmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_duplicated_termmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 448 | <button data-action="sweep_details" data-sweep_name="duplicated_termmeta" data-sweep_type="termmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_duplicated_termmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 449 | <?php else : ?> |
| 450 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 451 | <?php endif; ?> |
| 452 | </td> |
| 453 | </tr> |
| 454 | <tr> |
| 455 | <td> |
| 456 | <strong><?php esc_html_e( 'Orphaned Term Relationship', 'wp-sweep' ); ?></strong> |
| 457 | <p class="sweep-details" style="display: none;"></p> |
| 458 | </td> |
| 459 | <td> |
| 460 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $orphan_term_relationships ) ); ?></span> |
| 461 | </td> |
| 462 | <td> |
| 463 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $orphan_term_relationships, $total_term_relationships ) ); ?></span> |
| 464 | </td> |
| 465 | <td> |
| 466 | <?php if ( ! empty( $orphan_term_relationships ) ) : ?> |
| 467 | <button data-action="sweep" data-sweep_name="orphan_term_relationships" data-sweep_type="term_relationships" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_orphan_term_relationships' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 468 | <button data-action="sweep_details" data-sweep_name="orphan_term_relationships" data-sweep_type="term_relationships" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_orphan_term_relationships' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 469 | <?php else : ?> |
| 470 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 471 | <?php endif; ?> |
| 472 | </td> |
| 473 | </tr> |
| 474 | <tr class="alternate"> |
| 475 | <td> |
| 476 | <strong><?php esc_html_e( 'Unused Terms', 'wp-sweep' ); ?></strong> |
| 477 | <p><?php esc_html_e( 'Note that some unused terms might belong to draft posts that have not been published yet. Only sweep this when you do not have any draft posts.', 'wp-sweep' ); ?></p> |
| 478 | <p class="sweep-details" style="display: none;"></p> |
| 479 | </td> |
| 480 | <td> |
| 481 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $unused_terms ) ); ?></span> |
| 482 | </td> |
| 483 | <td> |
| 484 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $unused_terms, $total_terms ) ); ?></span> |
| 485 | </td> |
| 486 | <td> |
| 487 | <?php if ( ! empty( $unused_terms ) ) : ?> |
| 488 | <button data-action="sweep" data-sweep_name="unused_terms" data-sweep_type="terms" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_unused_terms' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 489 | <button data-action="sweep_details" data-sweep_name="unused_terms" data-sweep_type="terms" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_unused_terms' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 490 | <?php else : ?> |
| 491 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 492 | <?php endif; ?> |
| 493 | </td> |
| 494 | </tr> |
| 495 | </tbody> |
| 496 | </table> |
| 497 | <?php do_action( 'wp_sweep_admin_term_sweep' ); ?> |
| 498 | <p> </p> |
| 499 | <h3><?php esc_html_e( 'Option Sweep', 'wp-sweep' ); ?></h3> |
| 500 | <?php /* translators: %1 is the number of options */ ?> |
| 501 | <p><?php echo wp_kses_post( sprintf( __( 'There are a total of <strong class="attention"><span class="sweep-count-type-options">%s</span> Options</strong>.', 'wp-sweep' ), number_format_i18n( $total_options ) ) ); ?></p> |
| 502 | <div class="sweep-message"></div> |
| 503 | <table class="widefat table-sweep"> |
| 504 | <thead> |
| 505 | <tr> |
| 506 | <th class="col-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></th> |
| 507 | <th class="col-sweep-count"><?php esc_html_e( 'Count', 'wp-sweep' ); ?></th> |
| 508 | <th class="col-sweep-percent"><?php esc_html_e( '% Of', 'wp-sweep' ); ?></th> |
| 509 | <th class="col-sweep-action"><?php esc_html_e( 'Action', 'wp-sweep' ); ?></th> |
| 510 | </tr> |
| 511 | </thead> |
| 512 | <tbody> |
| 513 | <tr> |
| 514 | <td> |
| 515 | <strong><?php esc_html_e( 'Transient Options', 'wp-sweep' ); ?></strong> |
| 516 | <p class="sweep-details" style="display: none;"></p> |
| 517 | </td> |
| 518 | <td> |
| 519 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $transient_options ) ); ?></span> |
| 520 | </td> |
| 521 | <td> |
| 522 | <span class="sweep-percentage"><?php echo esc_html( WPSweep::get_instance()->format_percentage( $transient_options, $total_options ) ); ?></span> |
| 523 | </td> |
| 524 | <td> |
| 525 | <?php if ( ! empty( $transient_options ) ) : ?> |
| 526 | <button data-action="sweep" data-sweep_name="transient_options" data-sweep_type="options" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_transient_options' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 527 | <button data-action="sweep_details" data-sweep_name="transient_options" data-sweep_type="options" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_transient_options' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 528 | <?php else : ?> |
| 529 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 530 | <?php endif; ?> |
| 531 | </td> |
| 532 | </tr> |
| 533 | </tbody> |
| 534 | </table> |
| 535 | <?php do_action( 'wp_sweep_admin_option_sweep' ); ?> |
| 536 | <p> </p> |
| 537 | <h3><?php esc_html_e( 'Database Sweep', 'wp-sweep' ); ?></h3> |
| 538 | <?php /* translators: %1 is the number of database tables */ ?> |
| 539 | <p><?php echo wp_kses_post( sprintf( __( 'There are a total of <strong class="attention"><span class="sweep-count-type-tables">%s</span> Tables</strong>.', 'wp-sweep' ), number_format_i18n( $total_tables ) ) ); ?></p> |
| 540 | <div class="sweep-message"></div> |
| 541 | <table class="widefat table-sweep"> |
| 542 | <thead> |
| 543 | <tr> |
| 544 | <th class="col-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></th> |
| 545 | <th class="col-sweep-count"><?php esc_html_e( 'Count', 'wp-sweep' ); ?></th> |
| 546 | <th class="col-sweep-percent"><?php esc_html_e( '% Of', 'wp-sweep' ); ?></th> |
| 547 | <th class="col-sweep-action"><?php esc_html_e( 'Action', 'wp-sweep' ); ?></th> |
| 548 | </tr> |
| 549 | </thead> |
| 550 | <tbody> |
| 551 | <tr> |
| 552 | <td> |
| 553 | <strong><?php esc_html_e( 'Optimize Tables', 'wp-sweep' ); ?></strong> |
| 554 | <p class="sweep-details" style="display: none;"></p> |
| 555 | </td> |
| 556 | <td> |
| 557 | <span class="sweep-count"><?php echo esc_html( number_format_i18n( $total_tables ) ); ?></span> |
| 558 | </td> |
| 559 | <td> |
| 560 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 561 | </td> |
| 562 | <td> |
| 563 | <?php if ( ! empty( $total_tables ) ) : ?> |
| 564 | <button data-action="sweep" data-sweep_name="optimize_database" data-sweep_type="tables" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_optimize_database' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button> |
| 565 | <button data-action="sweep_details" data-sweep_name="optimize_database" data-sweep_type="tables" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_optimize_database' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button> |
| 566 | <?php else : ?> |
| 567 | <?php esc_html_e( 'N/A', 'wp-sweep' ); ?> |
| 568 | <?php endif; ?> |
| 569 | </td> |
| 570 | </tr> |
| 571 | </tbody> |
| 572 | </table> |
| 573 | <?php do_action( 'wp_sweep_admin_database_sweep' ); ?> |
| 574 | <p> </p> |
| 575 | <h3><?php esc_html_e( 'Sweep All', 'wp-sweep' ); ?></h3> |
| 576 | <p><?php esc_html_e( 'Note that some unused terms might belong to draft posts that have not been published yet. Only sweep all when you do not have any draft posts.', 'wp-sweep' ); ?></p> |
| 577 | <div class="sweep-all"> |
| 578 | <p style="text-align: center;"> |
| 579 | <button class="button button-primary btn-sweep-all"><?php esc_html_e( 'Sweep All', 'wp-sweep' ); ?></button> |
| 580 | </p> |
| 581 | </div> |
| 582 | </div> |
| 583 |