PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.1
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
← All changes | Inc/Classes/Upgrade.php +15 -33 4.2.113.2.4.1 View file →
@@ -1,21 +1,16 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Classes;
3 +namespace WPAdminify\Inc\Classes;
4 4
5 -if ( ! defined( 'ABSPATH' ) ) {
6 - exit; // Exit if accessed directly.
7 -}
5 +class Upgrade {
8 6
9 -class Upgrade
10 -{
11 -
12 7 /**
13 8 * Plugin version option key
14 9 *
15 10 * @var string $option_name
16 11 */
17 - protected $option_name = 'pxlbsadminify_version';
12 + protected $option_name = 'wp_adminify_version';
18 13
19 14 /**
20 15 * Lists of upgrades
21 16 *
@@ -21,13 +16,10 @@
21 16 *
22 17 * @var string[] $upgrades
23 18 */
24 19 protected $upgrades = [
25 - '3.0.2' => 'Upgrades/upgrade-3.0.2.php',
26 - '3.0.9' => 'Upgrades/upgrade-3.0.9.php',
27 - '3.2.4.4' => 'Upgrades/upgrade-3.2.4.4.php',
28 - '4.0.1' => 'Upgrades/upgrade-4.0.php',
29 - '4.2.0' => 'Upgrades/upgrade-4.2.0.php'
20 + '3.0.2' => 'Upgrades/upgrade-3.0.2.php',
21 + '3.0.9' => 'Upgrades/upgrade-3.0.9.php',
30 22 ];
31 23
32 24 /**
33 25 * Get plugin installed version
@@ -33,19 +25,10 @@
33 25 * Get plugin installed version
34 26 *
35 27 * @return string
36 28 */
37 - protected function get_installed_version()
38 - {
39 - $version = get_option($this->option_name, false);
40 -
41 - // Fall back to the legacy version option (renamed in v4.2.0) so existing
42 - // installs report their real version and historical upgrades don't re-run.
43 - if (false === $version) {
44 - $version = get_option('wp_adminify_version', '1.0.0');
45 - }
46 -
47 - return $version;
29 + protected function get_installed_version() {
30 + return get_option( $this->option_name, '1.0.0' );
48 31 }
49 32
50 33 /**
51 34 * Check if plugin's update is available
@@ -51,11 +34,10 @@
51 34 * Check if plugin's update is available
52 35 *
53 36 * @return bool
54 37 */
55 - public function if_updates_available()
56 - {
57 - if (version_compare($this->get_installed_version(), PXLBSADMINIFY_VER, '<')) {
38 + public function if_updates_available() {
39 + if ( version_compare( $this->get_installed_version(), WP_ADMINIFY_VER, '<' ) ) {
58 40 return true;
59 41 }
60 42
61 43 return false;
@@ -65,18 +47,18 @@
65 47 * Run plugin updates
66 48 *
67 49 * @return void
68 50 */
69 - public function run_updates()
70 - {
51 + public function run_updates() {
71 52 $installed_version = $this->get_installed_version();
72 - $path = trailingslashit(__DIR__);
53 + $path = trailingslashit( __DIR__ );
73 54
74 - foreach ($this->upgrades as $version => $file) {
75 - if (version_compare($installed_version, $version, '<')) {
55 + foreach ( $this->upgrades as $version => $file ) {
56 + if ( version_compare( $installed_version, $version, '<' ) ) {
76 57 include $path . $file;
77 58 }
78 59 }
79 60
80 - // update_option( $this->option_name, PXLBSADMINIFY_VER );
61 + // update_option( $this->option_name, WP_ADMINIFY_VER );
81 62 }
63 +
82 64 }