PluginProbe ʕ •ᴥ•ʔ
All-in-One Sticky Anything – Click to Call, Fixed Widget, Sticky Header, Menu & Sidebar / 1.1.4
All-in-One Sticky Anything – Click to Call, Fixed Widget, Sticky Header, Menu & Sidebar v1.1.4
1.1.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3
all-in-one-wp-sticky-anything / includes / Update.php
all-in-one-wp-sticky-anything / includes Last commit date
updates 1 month ago Admin.php 1 month ago Ajax.php 1 month ago Customizer.php 1 month ago Elementor.php 1 month ago Enqueue.php 1 month ago Hooks.php 1 month ago Install.php 1 month ago Main.php 1 month ago Update.php 1 month ago functions.php 1 month ago
Update.php
58 lines
1 <?php
2
3 namespace AI1WPSA;
4
5 defined('ABSPATH') || exit;
6
7 class Update {
8
9 /**
10 * The upgrades
11 *
12 * @var array
13 */
14 private static $upgrades = array('1.0.2');
15
16 public function installed_version() {
17 return get_option('ai1wpsa_version');
18 }
19
20 /**
21 * Check if the plugin needs any update
22 *
23 * @return boolean
24 */
25 public function needs_update() {
26 // may be it's the first install
27 if (empty($this->installed_version())) {
28 return false;
29 }
30
31 //if previous version is higher
32 if (version_compare($this->installed_version(), AI1WPSA_VERSION, '>')) {
33 return true;
34 }
35
36 return false;
37 }
38
39 /**
40 * Perform all the necessary upgrade routines
41 *
42 * @return void
43 */
44 public function perform_updates() {
45 foreach (self::$upgrades as $version) {
46 if (version_compare($this->installed_version(), $version, '>')) {
47 $file = AI1WPSA_INCLUDES . "/updates/Update-$version.php";
48
49 if (file_exists($file)) {
50 include_once $file;
51 }
52
53 update_option('ai1wpsa_version', $version);
54 }
55 }
56 }
57 }
58