Changeset 2592192
- Timestamp:
- 09/01/2021 03:24:16 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
button-visually-impaired/trunk/include/src/Core/Upgrade.php
r2592178 r2592192 42 42 */ 43 43 public function updateProcessComplete( \WP_Upgrader $upgrader, array $hook_extra ) { 44 $updated = false; 44 45 if ( is_array( $hook_extra ) && array_key_exists( 'action', $hook_extra ) && array_key_exists( 'type', $hook_extra ) && array_key_exists( 'plugins', $hook_extra ) ) { 45 46 if ( $hook_extra['action'] == 'update' && $hook_extra['type'] == 'plugin' && is_array( $hook_extra['plugins'] ) && ! empty( $hook_extra['plugins'] ) ) { … … 47 48 foreach ( $hook_extra['plugins'] as $key => $plugin ) { 48 49 if ( $this_plugin == $plugin ) { 50 $updated = true; 49 51 set_transient( 'bvi_updated', 1 ); 50 52 break; … … 54 56 } 55 57 } 58 59 if ( ! $updated ) { 60 return; 61 } 62 63 Activate::getInstance()->activation(); 56 64 } 57 65 … … 65 73 } 66 74 67 function notice() {68 // Check the transient to see if we've just updated the plugin69 if ( get_transient( 'bvi_updated' ) ) {70 echo '<div class="notice notice-success"> update</div>';71 delete_transient( 'bvi_updated' );72 }73 }74 75 75 /** 76 76 * Register hook. … … 79 79 add_action( 'upgrader_process_complete', [ $this, 'updateProcessComplete' ], 10, 2 ); 80 80 add_action( 'plugins_loaded', [ $this, 'updatePlugin' ] ); 81 add_action( 'admin_notices', [ $this, 'notice' ] );82 81 } 83 82 }
Note: See TracChangeset
for help on using the changeset viewer.