PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.10
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Rollback.php +22 -5 3.10.23.11.10 View file →
@@ -12,8 +12,9 @@
12 12 namespace ThemeisleSDK\Modules;
13 13
14 14 // Exit if accessed directly.
15 15 use ThemeisleSDK\Common\Abstract_Module;
16 +use ThemeisleSDK\Loader;
16 17 use ThemeisleSDK\Product;
17 18
18 19 if ( ! defined( 'ABSPATH' ) ) {
19 20 exit;
@@ -119,10 +120,10 @@
119 120 $url = $this->get_versions_api_url();
120 121 if ( empty( $url ) ) {
121 122 return [];
122 123 }
123 - $response = function_exists( 'wp_remote_get_wp_remote_get' )
124 - ? wp_remote_get_wp_remote_get( $url )
124 + $response = function_exists( 'vip_safe_wp_remote_get' )
125 + ? vip_safe_wp_remote_get( $url )
125 126 : wp_remote_get( $url ); //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get
126 127 if ( is_wp_error( $response ) ) {
127 128 return array();
128 129 }
@@ -183,9 +184,9 @@
183 184 $version = $this->get_rollback();
184 185 if ( empty( $version ) ) {
185 186 return $links;
186 187 }
187 - $links[] = '<a href="' . wp_nonce_url( admin_url( 'admin-post.php?action=' . $this->product->get_key() . '_rollback' ), $this->product->get_key() . '_rollback' ) . '">' . sprintf( apply_filters( $this->product->get_key() . '_rollback_label', 'Rollback to v%s' ), $version['version'] ) . '</a>';
188 + $links[] = '<a href="' . wp_nonce_url( admin_url( 'admin-post.php?action=' . $this->product->get_key() . '_rollback' ), $this->product->get_key() . '_rollback' ) . '">' . sprintf( apply_filters( $this->product->get_key() . '_rollback_label', Loader::$labels['rollback']['cta'] ), $version['version'] ) . '</a>';
188 189
189 190 return $links;
190 191 }
191 192
@@ -283,8 +284,24 @@
283 284 $theme = $folder . '/style.css';
284 285 $nonce = 'upgrade-theme_' . $theme;
285 286 $url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
286 287
288 + /**
289 + * The rollback will attach a temporary theme for the rollback to the transient.
290 + * However, when executing the upgrade for the attached theme we need to change the slug to the original theme slug.
291 + * This is because it will use the slug to create a temp folder for the theme used during the upgrade.
292 + */
293 + add_filter(
294 + 'upgrader_package_options',
295 + function ( $options ) use ( $folder, $theme ) {
296 + if ( isset( $options['hook_extra']['theme'] ) && $options['hook_extra']['theme'] === $theme && isset( $options['hook_extra']['temp_backup']['slug'] ) ) {
297 + $options['hook_extra']['temp_backup']['slug'] = $folder;
298 + }
299 +
300 + return $options;
301 + }
302 + );
303 +
287 304 $upgrader = new \Theme_Upgrader( new \Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) );
288 305 $upgrader->upgrade( $theme );
289 306 delete_transient( $this->product->get_key() . '_warning_rollback' );
290 307 wp_die(
@@ -377,10 +394,10 @@
377 394 /**
378 395 * Fires after the option has been updated.
379 396 *
380 397 * @param mixed $old_value The old option value.
381 - * @param mixed $value The new option value.
382 - * @param string $option Option name.
398 + * @param mixed $value The new option value.
399 + * @param string $option Option name.
383 400 */
384 401 public function update_active_plugins_action( $old_value, $value, $option ) {
385 402 delete_site_transient( 'update_plugins' );
386 403 wp_cache_delete( 'plugins', 'plugins' );