$current_version_array[0]) { return 'milestone'; } elseif ( $new_version_array[1] > $current_version_array[1] ) { return 'major'; } elseif ( isset($new_version_array[2]) && isset($current_version_array[2]) && $new_version_array[2] > $current_version_array[2] ) { return 'minor'; } return 'unknown'; } public function in_plugin_update_message($plugin_data, $r) { $current_version = $plugin_data['Version']; $new_version = $plugin_data['new_version']; $upgrade_magnitude = $this->get_upgrade_magnitude($current_version, $new_version); switch ($upgrade_magnitude) { case 'milestone': echo '
' . $this->update_message_milestone(); break; case 'major': echo '
' . $this->update_message_major(); break; default: echo '
' . $this->update_message_minor(); return; break; } } protected function disable_update() { $m = ''; return $m; } public function update_message_minor() { $message = '
' . __('This is a minor release of Age Gate, updating directly should not cause any issues, however do ensure you have backed up any previous version settings..', 'age-gate') . ' '; return $message; } public function update_message_major() { $message = '
' . __('WARNING', 'age-gate') . ': ' . __('This is a major release of Age Gate that could have unexpected results on your site.', 'age-gate') . ' '; $message .= __('While it should be safe to update, it is advised that test locally or on a staging site first.', 'age-gate'); return $message; } public function update_message_milestone() { $message = '
' . __('WARNING', 'age-gate') . ': ' . __('This is a milestone release of Age Gate that could have unexpected results on your site.', 'age-gate') . ' '; $message .= __('It is advised that you do not update on a live website and test locally or on a staging site first.', 'age-gate') . '

'; $message .= __('The update link has been disabled just to be safe, but if you are sure you want to update you can enable the update link here: ', 'age-gate') . ''; $message .= $this->disable_update(); return $message; } // Things to prompt testers! public function upcoming_release_notice() { if(isset($_GET['wp_age_gate_silence']) && $_GET['wp_age_gate_silence'] == 1){ update_option('wp_age_gate_stop_message', 1); } if(!$stop = get_option('wp_age_gate_stop_message')){ $link = add_query_arg( ['wp_age_gate_silence' => 1 ] ); echo '

Age Gate v2.0.0: Thank you for using Age Gate. Version 2 of the plugin is currently being tested. If you would like to try it, please see this thread.

Don’t show again

'; } } }