PluginProbe
Float menu – awesome floating side menu / 6.0
Float menu – awesome floating side menu v6.0
7.2.5 trunk 2.1 2.2 3.0.1 3.1 3.2.2 3.3.1 3.5 3.5.1 3.5.2 3.5.3. 3.5.4 4.0 4.1 4.1.1 4.2 4.3 4.3.1 4.3.2 5.0 5.0.1 5.0.2 5.0.3 5.1 All 57 releases
← All changes | classes/Update/UpdateDB.php +82 -41 trunk6.0 View file →
@@ -22,21 +22,58 @@
22 22
23 23 public static function init(): void {
24 24 $current_db_version = get_site_option( WOWP_Plugin::PREFIX . '_db_version' );
25 25
26 - if ( $current_db_version && version_compare( $current_db_version, '7.0', '>=' ) ) {
26 + if ( $current_db_version && version_compare( $current_db_version, '6.0', '>=' ) ) {
27 27 return;
28 28 }
29 29
30 30 self::start_update();
31 31
32 - update_site_option( WOWP_Plugin::PREFIX . '_db_version', '7.0' );
32 + update_site_option( WOWP_Plugin::PREFIX . '_db_version', '6.0' );
33 33 }
34 34
35 35 public static function start_update(): void {
36 + self::update_database();
37 + self::update_options();
36 38 self::update_fields();
37 39 }
38 40
41 + public static function update_database(): void {
42 +
43 + global $wpdb;
44 + $table = $wpdb->prefix . WOWP_Plugin::PREFIX;
45 + $charset_collate = $wpdb->get_charset_collate();
46 +
47 + $columns = "
48 + id mediumint(9) NOT NULL AUTO_INCREMENT,
49 + title VARCHAR(200) DEFAULT '' NOT NULL,
50 + param longtext DEFAULT '' NOT NULL,
51 + status boolean DEFAULT 0 NOT NULL,
52 + mode boolean DEFAULT 0 NOT NULL,
53 + tag text DEFAULT '' NOT NULL,
54 + PRIMARY KEY (id)
55 + ";
56 +
57 + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
58 +
59 + $sql = "CREATE TABLE $table ($columns) $charset_collate;";
60 + dbDelta( $sql );
61 + }
62 +
63 + public static function update_options(): void {
64 +
65 + $license = get_option( 'wow_license_key_fmp' );
66 + $status = get_option( 'wow_license_status_fmp' );
67 + if ( $license !== false ) {
68 + update_option( 'wow_license_key_' . WOWP_Plugin::PREFIX, $license );
69 + }
70 +
71 + if ( $status !== false ) {
72 + update_option( 'wow_license_status_' . WOWP_Plugin::PREFIX, $status );
73 + }
74 + }
75 +
39 76 public static function update_fields(): void {
40 77 $results = DBManager::get_all_data();
41 78
42 79 if ( empty( $results ) || ! is_array( $results ) ) {
@@ -42,19 +79,24 @@
42 79 if ( empty( $results ) || ! is_array( $results ) ) {
43 80 return;
44 81 }
45 82 foreach ( $results as $result ) {
46 - $param = maybe_unserialize( $result->param );
83 + $param = maybe_unserialize( $result->param );
84 + $status = ! empty( $param['menu_status'] ) ? 0 : 1;
85 + $test_mode = ! empty( $param['test_mode'] ) ? 1 : 0;
47 86
48 87 $param = self::update_param( $param );
49 88
50 89 $data = [
51 - 'param' => maybe_serialize( $param ),
90 + 'param' => maybe_serialize( $param ),
91 + 'status' => absint( $status ),
92 + 'mode' => absint( $test_mode ),
93 + 'tag' => '',
52 94 ];
53 95
54 96 $where = [ 'id' => $result->id ];
55 97
56 - $data_formats = [ '%s' ];
98 + $data_formats = [ '%s', '%d', '%d', '%s' ];
57 99
58 100 DBManager::update( $data, $where, $data_formats );
59 101
60 102 }
@@ -60,50 +102,49 @@
60 102 }
61 103 }
62 104
63 105 public static function update_param( $param ) {
64 - $count = ( ! empty( $param['menu_1']['item_type'] ) ) ? count( $param['menu_1']['item_type'] ) : '0';
65 - if ( $count > 0 ) {
66 - for ( $i = 0; $i < $count; $i ++ ) {
106 + // Responsive
107 + if ( ! isset( $param['mobile_on'] ) ) {
108 + $param['mobile_on'] = $param['include_mobile'] ?? 0;
109 + }
110 + if ( ! isset( $param['mobile'] ) ) {
111 + $param['mobile'] = $param['screen'] ?? 768;
112 + }
113 + if ( ! isset( $param['desktop_on'] ) ) {
114 + $param['desktop_on'] = $param['include_more_screen'] ?? 0;
115 + }
116 + if ( ! isset( $param['desktop'] ) ) {
117 + $param['desktop'] = $param['screen_more'] ?? 480;
118 + }
119 + if ( ! isset( $param['mobile_rules_on'] ) ) {
120 + $param['mobile_rules_on'] = $param['mobile_rules'] ?? 0;
121 + $param['mobile_rules'] = $param['mobile_screen'] ?? 768;
122 + }
67 123
68 - if ( $param['menu_1']['item_type'][ $i ] === 'popup' && ! isset( $param['menu_1']['popupcontent'][ $i ] ) && isset( $param['popupcontent'] ) ) {
69 - $param['menu_1']['popupcontent'][ $i ] = $param['popupcontent'];
70 - $param['menu_1']['popuptitle'][ $i ] = $param['popuptitle'];
71 - }
124 + if ( ! isset( $param['fontawesome'] ) ) {
125 + $param['fontawesome'] = $param['disable_fontawesome'] ?? 0;
126 + }
72 127
73 - if ( ! empty( $param['menu_1']['item_custom'][ $i ] ) && ! isset( $param['menu_1']['icon_type'][ $i ] ) ) {
74 - $param['menu_1']['icon_type'][ $i ] = 'image';
75 - }
76 128
77 - if ( ! empty( $param['menu_1']['item_custom_text_check'][ $i ] ) && ! isset( $param['menu_1']['icon_type'][ $i ] ) ) {
78 - $param['menu_1']['icon_type'][ $i ] = 'text';
79 - }
129 + // Show
130 + if ( ! is_array( $param['show'] ) ) {
131 + $show_old = ! empty( $param['show'] ) ? $param['show'] : 'shortcode';
80 132
81 - if ( isset( $param['menu_1']['item_icon_anomate'][ $i ] ) ) {
82 - $param['menu_1']['item_icon_anomate'][ $i ] = str_replace( "fa-", "-", $param['menu_1']['item_icon_anomate'][ $i ] );
83 - }
84 - }
85 - }
133 + $param['show'] = [];
134 + $param['operator'] = [];
135 + $param['page_type'] = [];
136 + $param['ids'] = [];
86 137
87 - if ( ! empty( $param['showAfterPosition'] ) && ! isset( $param['scroll_action'] ) ) {
88 - $param['scroll_action'] = 'show';
89 - $param['scroll'] = $param['showAfterPosition'];
90 - }
138 + $param['show'][0] = 'shortcode';
139 + $param['operator'][0] = '1';
140 + $param['page_type'][0] = 'is_front_page';
141 + $param['ids'][0] = '';
91 142
92 - if ( ! empty( $param['hideAfterPosition'] ) && ! isset( $param['scroll_action'] ) ) {
93 - $param['scroll_action'] = 'hide';
94 - $param['scroll'] = $param['hideAfterPosition'];
95 - }
96 -
97 - if ( isset( $param['windowColor'] ) && ! isset( $param['popup_head_bg'] ) ) {
98 - if ( $param['windowColor'] === 'black' ) {
99 - $param['popup_head_bg'] = '#2a2a2a';
100 - } elseif ( $param['windowColor'] === 'red' ) {
101 - $param['popup_head_bg'] = '#F23D3D';
102 - } elseif ( $param['windowColor'] === 'yellow' ) {
103 - $param['popup_head_bg'] = '#FFBD22';
104 - } elseif ( $param['windowColor'] === 'blue' ) {
105 - $param['popup_head_bg'] = '#4090FF';
143 + switch ( $show_old ) {
144 + case 'all':
145 + $param['show'][0] = 'everywhere';
146 + break;
106 147 }
107 148 }
108 149
109 150 return $param;