← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Rollback.php
+3
-20
3.10.13
→
3.10.7
View file →
| @@ -12,9 +12,8 @@ | ||
| 12 | 12 | namespace ThemeisleSDK\Modules; |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | 15 | use ThemeisleSDK\Common\Abstract_Module; |
| 16 | -use ThemeisleSDK\Loader; | |
| 17 | 16 | use ThemeisleSDK\Product; |
| 18 | 17 | |
| 19 | 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | 19 | exit; |
| @@ -184,9 +183,9 @@ | ||
| 184 | 183 | $version = $this->get_rollback(); |
| 185 | 184 | if ( empty( $version ) ) { |
| 186 | 185 | return $links; |
| 187 | 186 | } |
| 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>'; | |
| 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>'; | |
| 189 | 188 | |
| 190 | 189 | return $links; |
| 191 | 190 | } |
| 192 | 191 | |
| @@ -284,24 +283,8 @@ | ||
| 284 | 283 | $theme = $folder . '/style.css'; |
| 285 | 284 | $nonce = 'upgrade-theme_' . $theme; |
| 286 | 285 | $url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme ); |
| 287 | 286 | |
| 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 | - | |
| 304 | 287 | $upgrader = new \Theme_Upgrader( new \Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) ); |
| 305 | 288 | $upgrader->upgrade( $theme ); |
| 306 | 289 | delete_transient( $this->product->get_key() . '_warning_rollback' ); |
| 307 | 290 | wp_die( |
| @@ -394,10 +377,10 @@ | ||
| 394 | 377 | /** |
| 395 | 378 | * Fires after the option has been updated. |
| 396 | 379 | * |
| 397 | 380 | * @param mixed $old_value The old option value. |
| 398 | - * @param mixed $value The new option value. | |
| 399 | - * @param string $option Option name. | |
| 381 | + * @param mixed $value The new option value. | |
| 382 | + * @param string $option Option name. | |
| 400 | 383 | */ |
| 401 | 384 | public function update_active_plugins_action( $old_value, $value, $option ) { |
| 402 | 385 | delete_site_transient( 'update_plugins' ); |
| 403 | 386 | wp_cache_delete( 'plugins', 'plugins' ); |