| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * Category Manipulations tab partial: Remove Not Assigned Media.
- *
- * @package Studiou_WC_Product_Cat_Manage
- *
- * @var Studiou_WC_Product_Cat_Manage_Manipulator $manipulator
- */
- // If this file is called directly, abort.
- if (!defined('WPINC')) {
- die;
- }
- $unassigned_media_count = $manipulator->get_unassigned_unused_media_count();
- ?>
- <!-- Remove Not Assigned Media Operation -->
- <div class="studiou-wcpcm-card">
- <h2><?php echo esc_html__('Remove Not Assigned Media', 'studiou-wc-product-cat-manage'); ?></h2>
- <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>
- <form id="studiou-wcpcm-remove-unassigned-media-form" method="post" onsubmit="return false;">
- <div class="studiou-wcpcm-warning-message">
- <p><strong><?php echo esc_html__('WARNING: This action cannot be undone.', 'studiou-wc-product-cat-manage'); ?></strong></p>
- <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>
- <ul>
- <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>
- <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>
- <li><?php echo esc_html__('Files attached to WooCommerce downloadable products.', 'studiou-wc-product-cat-manage'); ?></li>
- </ul>
- <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>
- </div>
- <div class="submit-buttons">
- <button type="submit" class="button button-primary button-danger" id="studiou-wcpcm-remove-unassigned-media-button">
- <?php echo esc_html(sprintf(__('Delete unused uncategorized media (%d)', 'studiou-wc-product-cat-manage'), $unassigned_media_count)); ?>
- </button>
- <span class="spinner"></span>
- </div>
- </form>
- <div class="studiou-wcpcm-remove-unassigned-media-progress" style="display: none;">
- <h3><?php echo esc_html__('Deletion Progress', 'studiou-wc-product-cat-manage'); ?></h3>
- <div class="studiou-wcpcm-progress-bar-container">
- <div class="studiou-wcpcm-progress-bar" id="studiou-wcpcm-remove-unassigned-media-progress-bar"></div>
- </div>
- <div class="studiou-wcpcm-progress-text" id="studiou-wcpcm-remove-unassigned-media-progress-text"></div>
- </div>
- <div class="studiou-wcpcm-remove-unassigned-media-results" style="display: none;">
- <h3><?php echo esc_html__('Deletion Results', 'studiou-wc-product-cat-manage'); ?></h3>
- <div id="studiou-wcpcm-remove-unassigned-media-message"></div>
- </div>
- </div>
|