PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.19
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.19
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / class-upgrades.php

class-upgrades.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.6.19, at includes/class-upgrades.php

64 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 /**
4 * Plugin Upgrade Routine
5 *
6 * @since 1.1.2
7 */
8 class WeForms_Upgrades {
9
10 /**
11 * The upgrades
12 *
13 * @var array
14 */
15 private static $upgrades = [];
16
17 /**
18 * Get the plugin version
19 *
20 * @return string
21 */
22 public function get_version() {
23 return get_option( 'weforms_version' );
24 }
25
26 /**
27 * Check if the plugin needs any update
28 *
29 * @return bool
30 */
31 public function needs_update() {
32
33 // may be it's the first install
34 if ( !$this->get_version() ) {
35 return false;
36 }
37
38 if ( version_compare( $this->get_version(), WEFORMS_VERSION, '<' ) ) {
39 return true;
40 }
41
42 return false;
43 }
44
45 /**
46 * Perform all the necessary upgrade routines
47 *
48 * @return void
49 */
50 public function perform_updates() {
51 $installed_version = $this->get_version();
52 $path = trailingslashit( __DIR__ );
53
54 foreach ( self::$upgrades as $version => $file ) {
55 if ( version_compare( $installed_version, $version, '<' ) ) {
56 include $path . $file;
57 update_option( 'weforms_version', $version );
58 }
59 }
60
61 update_option( 'weforms_version', WEFORMS_VERSION );
62 }
63 }
64