tab-remove-unassigned.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Category Manipulations tab partial: Remove Not Assigned Media.
  4. *
  5. * @package Studiou_WC_Product_Cat_Manage
  6. *
  7. * @var Studiou_WC_Product_Cat_Manage_Manipulator $manipulator
  8. */
  9. // If this file is called directly, abort.
  10. if (!defined('WPINC')) {
  11. die;
  12. }
  13. $unassigned_media_count = $manipulator->get_unassigned_unused_media_count();
  14. ?>
  15. <!-- Remove Not Assigned Media Operation -->
  16. <div class="studiou-wcpcm-card">
  17. <h2><?php echo esc_html__('Remove Not Assigned Media', 'studiou-wc-product-cat-manage'); ?></h2>
  18. <p><?php echo esc_html__('This operation permanently deletes media files that are not assigned to any media category and are not detected as in use. Detection covers: post/page/product featured images, WooCommerce product gallery images, attached media (post_parent), media-category membership, and — since v1.6.2 — WooCommerce product-category images (termmeta), the customizer custom logo, site icon, and header image.', 'studiou-wc-product-cat-manage'); ?></p>
  19. <form id="studiou-wcpcm-remove-unassigned-media-form" method="post" onsubmit="return false;">
  20. <div class="studiou-wcpcm-warning-message">
  21. <p><strong><?php echo esc_html__('WARNING: This action cannot be undone.', 'studiou-wc-product-cat-manage'); ?></strong></p>
  22. <p><?php echo esc_html__('Detection is heuristic. The following references are NOT detected and the media WILL be deleted if it is only used this way:', 'studiou-wc-product-cat-manage'); ?></p>
  23. <ul>
  24. <li><?php echo esc_html__('Images embedded only in post / page / product content HTML (including page builders that store HTML).', 'studiou-wc-product-cat-manage'); ?></li>
  25. <li><?php echo esc_html__('Images referenced from ACF, custom postmeta, custom termmeta keys other than "thumbnail_id", or theme options.', 'studiou-wc-product-cat-manage'); ?></li>
  26. <li><?php echo esc_html__('Files attached to WooCommerce downloadable products.', 'studiou-wc-product-cat-manage'); ?></li>
  27. </ul>
  28. <p><strong><?php echo esc_html__('Treat this button as: "delete media that nothing I can detect is using." If unsure, back up the uploads folder first.', 'studiou-wc-product-cat-manage'); ?></strong></p>
  29. </div>
  30. <div class="submit-buttons">
  31. <button type="submit" class="button button-primary button-danger" id="studiou-wcpcm-remove-unassigned-media-button">
  32. <?php echo esc_html(sprintf(__('Delete unused uncategorized media (%d)', 'studiou-wc-product-cat-manage'), $unassigned_media_count)); ?>
  33. </button>
  34. <span class="spinner"></span>
  35. </div>
  36. </form>
  37. <div class="studiou-wcpcm-remove-unassigned-media-progress" style="display: none;">
  38. <h3><?php echo esc_html__('Deletion Progress', 'studiou-wc-product-cat-manage'); ?></h3>
  39. <div class="studiou-wcpcm-progress-bar-container">
  40. <div class="studiou-wcpcm-progress-bar" id="studiou-wcpcm-remove-unassigned-media-progress-bar"></div>
  41. </div>
  42. <div class="studiou-wcpcm-progress-text" id="studiou-wcpcm-remove-unassigned-media-progress-text"></div>
  43. </div>
  44. <div class="studiou-wcpcm-remove-unassigned-media-results" style="display: none;">
  45. <h3><?php echo esc_html__('Deletion Results', 'studiou-wc-product-cat-manage'); ?></h3>
  46. <div id="studiou-wcpcm-remove-unassigned-media-message"></div>
  47. </div>
  48. </div>