PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / trunk
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts vtrunk
2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 All 28 releases
← All changes | admin/includes/class.import.snippet.php +7 -4 2.7.0trunk View file →
@@ -212,10 +212,9 @@
212 212 try {
213 213 $iterator = new DirectoryIterator( $dir_path );
214 214 foreach ( $iterator as $file_info ) {
215 215 if ( $file_info->isFile() ) {
216 - // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_unlink -- Deleting temporary files in wp_upload_dir().
217 - unlink( $file_info->getPathname() );
216 + wp_delete_file( $file_info->getPathname() );
218 217 }
219 218 }
220 219 } catch ( Exception $e ) {
221 220 return;
@@ -220,10 +219,13 @@
220 219 } catch ( Exception $e ) {
221 220 return;
222 221 }
223 222
224 - // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.directory_rmdir -- Deleting temporary directory in wp_upload_dir().
225 - rmdir( $dir_path );
223 + $wp_filesystem = WINP_Helper::get_wp_filesystem();
224 +
225 + if ( false !== $wp_filesystem ) {
226 + $wp_filesystem->rmdir( $dir_path, true );
227 + }
226 228 }
227 229
228 230 /**
229 231 * Update taxonomy tags
@@ -292,8 +294,9 @@
292 294 $this->update_meta( $snippet['id'], 'snippet_description', $snippet['description'] );
293 295 $this->update_meta( $snippet['id'], 'snippet_tags', $snippet['attributes'] );
294 296 $this->update_meta( $snippet['id'], 'snippet_activate', 0 );
295 297 $this->update_meta( $snippet['id'], 'snippet_priority', $snippet['priority'] );
298 + $this->update_meta( $snippet['id'], 'snippet_custom_name', $snippet['custom_name'] );
296 299
297 300 $this->update_taxonomy_tags( $snippet['id'], $snippet['tags'] );
298 301
299 302 return $snippet['id'];