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