PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.1.17
Adminify – White Label, Admin Menu Editor, Login Customizer v4.1.17
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 4.1.17 All 164 releases
adminify / Inc / Classes / Upgrade.php

Upgrade.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.1.17, at Inc/Classes/Upgrade.php

74 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Classes;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 class Upgrade
10 {
11
12 /**
13 * Plugin version option key
14 *
15 * @var string $option_name
16 */
17 protected $option_name = 'wp_adminify_version';
18
19 /**
20 * Lists of upgrades
21 *
22 * @var string[] $upgrades
23 */
24 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 ];
30
31 /**
32 * Get plugin installed version
33 *
34 * @return string
35 */
36 protected function get_installed_version()
37 {
38 return get_option($this->option_name, '1.0.0');
39 }
40
41 /**
42 * Check if plugin's update is available
43 *
44 * @return bool
45 */
46 public function if_updates_available()
47 {
48 if (version_compare($this->get_installed_version(), WP_ADMINIFY_VER, '<')) {
49 return true;
50 }
51
52 return false;
53 }
54
55 /**
56 * Run plugin updates
57 *
58 * @return void
59 */
60 public function run_updates()
61 {
62 $installed_version = $this->get_installed_version();
63 $path = trailingslashit(__DIR__);
64
65 foreach ($this->upgrades as $version => $file) {
66 if (version_compare($installed_version, $version, '<')) {
67 include $path . $file;
68 }
69 }
70
71 // update_option( $this->option_name, WP_ADMINIFY_VER );
72 }
73 }
74