PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 1.2.0
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v1.2.0
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
hurrytimer / includes / class-hurrytimer-activator.php

class-hurrytimer-activator.php in HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce 1.2.0, at includes/class-hurrytimer-activator.php

78 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Hurrytimer;
3
4 /**
5 * Fired during plugin activation
6 *
7 * @link http://nabillemsieh.com
8 * @since 1.0.0
9 *
10 * @package Hurrytimer
11 * @subpackage Hurrytimer/includes
12 */
13
14 /**
15 * Fired during plugin activation.
16 *
17 * This class defines all code necessary to run during the plugin's activation.
18 *
19 * @since 1.0.0
20 * @package Hurrytimer
21 * @subpackage Hurrytimer/includes
22 * @author Nabil Lemsieh <contact@nabillemsieh.com>
23 */
24 class Hurrytimer_Activator
25 {
26
27 /**
28 * Short Description. (use period)
29 *
30 * Long Description.
31 *
32 * @since 1.0.0
33 */
34 public static function activate()
35 {
36 $sql_builder = new SQL_Builder('hurrytimer_evergreen');
37
38 $sql_builder
39 ->create()
40 ->bigint('id', 20, true, false, true)
41 ->bigint('countdown_id', 20, true)
42 ->string('client_ip_address', 50, false)
43 ->boolean('expired')
44 ->bigint('client_expires_at', 20, true)
45 ->timestamp('destroy_at', true)
46 ->primary_key('id')
47 ->run();
48
49 static::maybe_backward_compat();
50 update_option('hurrytimer_version', HURRYTIMER_PLUGIN_VERSION);
51 }
52
53 public static function maybe_backward_compat()
54 {
55 $current_version = get_option('hurrytimer_version');
56 if (version_compare($current_version, '1.1.3', '<=')) {
57 @delete_option('_htmr_reset_cookie');
58 }
59 if (version_compare($current_version, '1.0.1', '<=')) {
60 $result = get_posts(['post_type' => 'hurrytimer_countdown']);
61 foreach ($result as $item) {
62 $countdown = new Hurrytimer_Countdown($item->ID);
63 $headline_status = get_post_meta($item->ID, 'headline_status', true);
64 if (intval($headline_status) === Headline_Status::HIDE) {
65 $countdown->set_display_headline(false);
66 $countdown->set_headline_position(Headline_Position::ABOVE_TIMER);
67 } else {
68 $countdown->set_display_headline(true);
69 $countdown->set_headline_position($headline_status);
70 }
71 delete_post_meta($item->ID, 'headline_status');
72 }
73
74 }
75 }
76
77 }
78