PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / includes / utils / class-wpfnl-activator.php

class-wpfnl-activator.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 2.8.16, at includes/utils/class-wpfnl-activator.php

120 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Fired during plugin activation
5 *
6 * @link https://rextheme.com
7 * @since 1.0.0
8 *
9 * @package Wpfnl
10 * @subpackage Wpfnl/includes
11 */
12
13 use WPFunnels\Wpfnl;
14 use WPFunnels\Wpfnl_functions;
15
16 /**
17 * Fired during plugin activation.
18 *
19 * This class defines all code necessary to run during the plugin's activation.
20 *
21 * @since 1.0.0
22 * @package Wpfnl
23 * @subpackage Wpfnl/includes
24 * @author RexTheme <[email protected]>
25 */
26 class Wpfnl_Activator
27 {
28
29 /**
30 * Short Description. (use period)
31 *
32 * Long Description.
33 *
34 * @since 1.0.0
35 */
36 public static function activate()
37 {
38
39 self::set_wpfunnels_activation_transients();
40 self::update_wpfunnles_version();
41 self::update_wpfunnels_db_version();
42 self::update_installed_time();
43
44 // add funnel type meta
45 Wpfnl_functions::add_type_meta();
46
47
48 }
49
50
51
52
53 /**
54 * Update WP Funnels version to current.
55 *
56 * @since 1.0.0
57 */
58 private static function update_wpfunnles_version()
59 {
60 update_site_option('wpfunnels_version', Wpfnl::get_instance()->get_version());
61 }
62
63
64 /**
65 * See if we need to redirect the admin to setup wizard or not.
66 *
67 * @since 1.0.0
68 */
69 private static function set_wpfunnels_activation_transients()
70 {
71 if (self::is_new_install()) {
72 set_transient('_wpfunnels_activation_redirect', 1, 30);
73 }
74 }
75
76 /**
77 * Brand new install of wpfunnels
78 *
79 * @return bool
80 * @since 1.0.0
81 */
82 public static function is_new_install()
83 {
84 return is_null(get_site_option('wpfunnels_version', null));
85 }
86
87 /**
88 * Update db version to current
89 *
90 * @param null $version
91 *
92 * @since 1.0.0
93 */
94 private static function update_wpfunnels_db_version($version = null)
95 {
96 update_site_option('wpfunnels_db_version', is_null($version) ? Wpfnl::get_instance()->get_version() : $version);
97 }
98
99
100 /**
101 * Retrieve the time when funnel is installed
102 *
103 * @return int|mixed|void
104 * @since 2.0.0
105 */
106 public static function get_installed_time() {
107 $installed_time = get_option( 'wpfunnels_installed_time' );
108 if ( ! $installed_time ) {
109 $installed_time = time();
110 update_site_option( 'wpfunnels_installed_time', $installed_time );
111 }
112 return $installed_time;
113 }
114
115
116 public static function update_installed_time() {
117 self::get_installed_time();
118 }
119 }
120