Changeset 3248934
- Timestamp:
- 03/01/2025 05:16:48 PM (13 months ago)
- Location:
- auto-attachments-cleaner/trunk
- Files:
-
- 2 added
- 3 edited
-
README.txt (modified) (3 diffs)
-
assets/css/admin-style.css (modified) (1 diff)
-
auto-attachments-cleaner.php (modified) (4 diffs)
-
languages/auto-attachments-cleaner-it_IT.l10n.php (added)
-
screenshot-4.png (added)
Legend:
- Unmodified
- Added
- Removed
-
auto-attachments-cleaner/trunk/README.txt
r3211918 r3248934 5 5 Requires at least: 5.0 6 6 Tested up to: 6.7 7 Stable Tag: 1.0. 37 Stable Tag: 1.0.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 27 27 = When are attachments deleted? = 28 When the post is permanently deleted from the trash or the trash is emptied 28 29 29 When the post is permanently deleted from the trash or the trash is emptied 30 = Are all thumbnails created by wordpress also deleted? = 31 Yes, a native WordPress function is used for deleting images, which also deletes all thumbnails created 32 33 = Is Woo Commerce supported? = 34 Yes Woo Commerce is supported, all plugin that works with Custom Post Type are compatible. 30 35 31 36 … … 35 40 2. Plugin settings 36 41 3. Where plugin works (trash) 42 4. Warning notice on Trash Page 37 43 38 44 == Changelog == 45 46 = 1.0.4 = 47 * [NEW] - Introduced Warning notice on Empty Trash button and on post row actions near to 'permanently delete' link 48 49 = 1.0.3 = 50 * [FIX] - Bug Fix 39 51 40 52 = 1.0.2 = -
auto-attachments-cleaner/trunk/assets/css/admin-style.css
r3211918 r3248934 26 26 border-bottom: none; 27 27 } 28 29 .aac-notice-warning{ 30 background: #fff; 31 border: 1px solid #c3c4c7; 32 border-left-color: #dba617; 33 border-left-width: 4px; 34 box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); 35 margin: 5px 0; 36 padding: 2px 5px 3px 5px; 37 font-size: 12px; 38 font-weight: 500; 39 color: #da0000; 40 } 41 42 43 .aac-notice-warning.hidden{ 44 display: none; 45 } 46 47 48 .hentry:hover .aac-notice-warning.hidden{ 49 display: block; 50 } -
auto-attachments-cleaner/trunk/auto-attachments-cleaner.php
r3211918 r3248934 9 9 * Plugin URI: https://www.stefanofattori.it/wordpress/plugins/ 10 10 * Description: Automatically deletes attachments (images, videos, files etc...) linked to a page, post or custom post type when it is deleted. 11 * Version: 1.0. 311 * Version: 1.0.4 12 12 * Requires at least: 5.0 13 13 * Requires PHP: 7.0 … … 31 31 * Start at version 1.0.0 and use SemVer - https://semver.org 32 32 */ 33 define( 'AUTO_ATTACHMENTS_CLEANER_VERSION', '1.0. 3' );33 define( 'AUTO_ATTACHMENTS_CLEANER_VERSION', '1.0.4' ); 34 34 35 35 … … 71 71 add_action( 'before_delete_post', [ $this, 'delete_post_attachments' ] ); 72 72 add_action( 'admin_notices', [ $this, 'display_attachments_deletion_notice' ], 20 ); 73 74 75 // Show Warning Notice on permantly deleting post 76 add_filter( 'post_row_actions', [ $this, 'add_delete_attachments_notice_to_post_row' ], 99, 2 ); 77 add_filter( 'page_row_actions', [ $this, 'add_delete_attachments_notice_to_post_row' ], 99, 2 ); 78 79 // Show Warning Notice on near to Empty Trash button 80 add_action( 'manage_posts_extra_tablenav', [ $this, 'add_delete_attachments_notice_to_empty_trash_button' ] ); 81 add_action( 'manage_pages_extra_tablenav', [ $this, 'add_delete_attachments_notice_to_empty_trash_button' ] ); 73 82 } 74 83 … … 131 140 ); 132 141 } 142 143 144 145 /** 146 * Show a warning notice near to Empty Trash button on top of the trash page 147 * @param mixed $which 148 * @return void 149 */ 150 public function add_delete_attachments_notice_to_empty_trash_button( $which ) { 151 global $typenow; // Actual Post Type 152 153 // Check the post type and user settings 154 $selected_post_types = get_option( 'auto_attachments_cleaner_post_types', [] ); 155 156 if ( isset( $_GET['post_status'] ) && $_GET['post_status'] === 'trash' && in_array( $typenow, $selected_post_types, true ) ) { 157 if ( $which === 'top' ) { 158 echo '<div class="alignleft aac-notice-warning"><span>' 159 . esc_html__( '⚠️ Caution: Emptying the trash will also irreversibly delete all related attachments of each post!', 'auto-attachments-cleaner' ) 160 . '</span></div>'; 161 } 162 } 163 } 164 165 166 /** 167 * Show a warning notice near to each post row 168 * @param mixed $actions 169 * @param mixed $post 170 */ 171 public function add_delete_attachments_notice_to_post_row( $actions, $post ) { 172 // Check the post type and user settings 173 $post_type = get_post_type( $post->ID ); 174 $selected_post_types = get_option( 'auto_attachments_cleaner_post_types', [] ); 175 176 if ( in_array( $post_type, $selected_post_types, true ) ) { 177 if ( get_query_var( 'post_status' ) === 'trash' && isset( $actions['delete'] ) ) { 178 $actions['aac-notice'] = '<div class="aac-notice-warning hidden"><span>' . esc_html__( '⚠️ Caution: permanently deleting this post will also irreversibly delete all related attachments!', 'auto-attachments-cleaner' ) . '</span></div>'; 179 } 180 } 181 return $actions; 182 } 183 133 184 134 185
Note: See TracChangeset
for help on using the changeset viewer.