getMagnitude($current, $new) . 'Message'; $devs = [ 'dev', 'alpha', 'beta', 'rc', ]; $version = AGE_GATE_VERSION . $current; $found = false; foreach ($devs as $str) { if ($found) { continue; } $found = stripos($version, $str) !== false; } if ($found) { echo wp_kses_post($this->getDevMessage()); return; } echo wp_kses_post($this->$method()); } private function getMagnitude($current, $new) { $current = explode('.', (string) $current); $new = explode('.', (string) $new); if ($new[0] > $current[0]) { return 'Major'; } elseif ($new[1] > $current[1]) { return 'Minor'; } elseif (isset($new[2]) && isset($current[2]) && $new[2] > $current[2]) { return 'Patch'; } return 'unknown'; } private function getPatchMessage() { return '

' . __('This is a patch release of Age Gate, updating directly should not cause any issues, however do ensure you have backed up any previous version settings.', 'age-gate') . ' '; } private function getMinorMessage() { $message = '

' . __('WARNING', 'age-gate') . ': ' . __('This is a minor 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 you test locally or on a staging site first.', 'age-gate'); return $message; } private function getMajorMessage() { $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->disableUpdate(); return $message; } private function getDevMessage() { $message = '

' . __('WARNING', 'age-gate') . ': ' . __('You are updating from a development version of Age Gate, some features, settings or functionality may no longer be available. Check the release notes and proceed with caution', 'age-gate') . ' '; $message .= $this->disableUpdate(); return $message; } private function getUnknownMessage() { } private function disableUpdate() { return ''; } }