PluginProbe
Image Source Control Lite – Show Image Credits and Captions / trunk
Image Source Control Lite – Show Image Credits and Captions vtrunk
3.12.0 3.11.0 trunk 1.1 1.1.1 1.1.2 1.1.2.1 1.1.3 1.10 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.2 1.2.0.1 1.2.0.2 1.2.0.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.4.1 1.3.5 All 110 releases
← All changes | uninstall.php +48 -3 1.3.2trunk View file →
@@ -1,4 +1,49 @@
1 1 <?php
2 -if(!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN'))
3 - exit();
4 -delete_option('isc_options');
2 +if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3 + exit();
4 +}
5 +
6 +// check if the option to remove data on uninstall is enabled
7 +$options = get_option( 'isc_options' );
8 +if ( ! empty( $options['remove_on_uninstall'] ) ) {
9 + global $wpdb;
10 +
11 + // delete post meta fields
12 + delete_post_meta_by_key( 'isc_post_images' );
13 + delete_post_meta_by_key( 'isc_image_posts' );
14 + delete_post_meta_by_key( 'isc_image_source' );
15 + delete_post_meta_by_key( 'isc_image_source_own' );
16 + delete_post_meta_by_key( 'isc_image_source_url' );
17 + delete_post_meta_by_key( 'isc_ai_label' );
18 + delete_post_meta_by_key( 'isc_possible_usages' );
19 + delete_post_meta_by_key( 'isc_possible_usages_last_check' );
20 + delete_post_meta_by_key( 'isc_post_images_before_update' );
21 + delete_post_meta_by_key( 'isc_last_index' );
22 + delete_post_meta_by_key( 'isc_ignored_unused_image' );
23 +
24 + // delete main plugin options
25 + delete_option( 'isc_options' );
26 + // delete storage
27 + delete_option( 'isc_storage' );
28 + // delete the total number of unused images (Pro). Option no longer set since version 3.9
29 + delete_option( 'isc_unused_images_total_items' );
30 + // delete the last log created by the Scanner
31 + delete_option( 'isc_scanner_log' );
32 +
33 + // delete user meta
34 + delete_metadata( 'user', null, 'isc_newsletter_subscribed', '', true );
35 +
36 + // drop the index table
37 + $table_name = $wpdb->prefix . 'isc_index';
38 + // phpcs:ignore
39 + $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
40 +
41 + // delete the log file if it exists
42 + $upload_dir = wp_upload_dir();
43 + // Hash the AUTH_KEY to create the same filename that was used
44 + $log_file_name = 'image-source-control_' . hash( 'crc32', AUTH_KEY ) . '.log';
45 + $log_file_path = $upload_dir['basedir'] . '/' . $log_file_name;
46 + if ( file_exists( $log_file_path ) ) {
47 + wp_delete_file( $log_file_path );
48 + }
49 +}