PluginProbe
Polylang / 2.6.2
Polylang v2.6.2
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | uninstall.php +8 -12 2.72.6.2 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { // If uninstall not called from WordPress exit
4 - exit;
4 + exit();
5 5 }
6 6
7 7 /**
8 8 * Manages Polylang uninstallation
@@ -19,13 +19,8 @@
19 19 */
20 20 public function __construct() {
21 21 global $wpdb;
22 22
23 - // Don't do anything except if the constant PLL_REMOVE_ALL_DATA is explicitely defined and true.
24 - if ( ! defined( 'PLL_REMOVE_ALL_DATA' ) || ! PLL_REMOVE_ALL_DATA ) {
25 - return;
26 - }
27 -
28 23 // Check if it is a multisite uninstall - if so, run the uninstall function for each blog id
29 24 if ( is_multisite() ) {
30 25 foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ) as $blog_id ) {
31 26 switch_to_blog( $blog_id );
@@ -44,8 +39,14 @@
44 39 *
45 40 * @since 0.5
46 41 */
47 42 public function uninstall() {
43 + $options = get_option( 'polylang' );
44 +
45 + if ( empty( $options['uninstall'] ) ) {
46 + return;
47 + }
48 +
48 49 global $wpdb;
49 50
50 51 // Executes each module's uninstall script, if it exists
51 52 $pll_modules_dir = dirname( __FILE__ ) . '/modules';
@@ -53,9 +54,9 @@
53 54 while ( ( $module = readdir() ) != false ) {
54 55 if ( substr( $module, 0, 1 ) !== '.' ) {
55 56 $uninstall_script = $pll_modules_dir . '/' . $module . '/uninstall.php';
56 57 if ( file_exists( $uninstall_script ) ) {
57 - require $uninstall_script; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
58 + require $uninstall_script;
58 59 }
59 60 }
60 61 }
61 62 closedir();
@@ -82,9 +83,8 @@
82 83
83 84 // Delete users options
84 85 foreach ( get_users( array( 'fields' => 'ID' ) ) as $user_id ) {
85 86 delete_user_meta( $user_id, 'pll_filter_content' );
86 - delete_user_meta( $user_id, 'pll_dismissed_notices' ); // Legacy meta.
87 87 foreach ( $languages as $lang ) {
88 88 delete_user_meta( $user_id, 'description_' . $lang->slug );
89 89 }
90 90 }
@@ -125,11 +125,8 @@
125 125 wp_delete_post( $id, true );
126 126 }
127 127
128 128 // Delete all what is related to languages and translations
129 - $term_ids = array();
130 - $tt_ids = array();
131 -
132 129 foreach ( get_terms( $pll_taxonomies, array( 'hide_empty' => false ) ) as $term ) {
133 130 $term_ids[] = (int) $term->term_id;
134 131 $tt_ids[] = (int) $term->term_taxonomy_id;
135 132 }
@@ -149,9 +146,8 @@
149 146 delete_option( 'polylang' );
150 147 delete_option( 'widget_polylang' ); // Automatically created by WP
151 148 delete_option( 'polylang_wpml_strings' ); // Strings registered with icl_register_string
152 149 delete_option( 'polylang_licenses' );
153 - delete_option( 'pll_dismissed_notices' );
154 150
155 151 // Delete transients
156 152 delete_transient( 'pll_languages_list' );
157 153 delete_transient( 'pll_upgrade_1_4' );