Changeset 3444913
- Timestamp:
- 01/22/2026 02:42:29 PM (2 months ago)
- Location:
- mametech-chat-button/trunk
- Files:
-
- 2 edited
-
mametech-chat-button.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mametech-chat-button/trunk/mametech-chat-button.php
r3444879 r3444913 4 4 * Plugin URI: https://www.mametech.com/mametech-chat-button 5 5 * Description: Plugin completo con widget, shortcode, orari, numeri multipli, statistiche e temi per chat flottante 6 * Version: 2.1. 26 * Version: 2.1.3 7 7 * Author: Mario Merola 8 8 * Author URI: https://www.mametech.com … … 19 19 20 20 // Definizione delle costanti del plugin 21 define('MAMETECH_CB_VERSION', '2.1. 2');21 define('MAMETECH_CB_VERSION', '2.1.3'); 22 22 define('MAMETECH_CB_PLUGIN_DIR', plugin_dir_path(__FILE__)); 23 23 define('MAMETECH_CB_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 124 124 125 125 /** 126 * Assicura che la tabella statistiche esista 127 */ 128 private function ensure_stats_table_exists() { 129 global $wpdb; 130 $table_name = $wpdb->prefix . 'mametech_cb_stats'; 131 132 // Controlla se la tabella esiste 133 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 134 $table_exists = $wpdb->get_var( 135 $wpdb->prepare( 136 "SHOW TABLES LIKE %s", 137 $table_name 138 ) 139 ); 140 141 // Se non esiste, creala 142 if ($table_exists !== $table_name) { 143 $charset_collate = $wpdb->get_charset_collate(); 144 145 $sql = "CREATE TABLE $table_name ( 146 id bigint(20) NOT NULL AUTO_INCREMENT, 147 button_id varchar(50) NOT NULL DEFAULT 'main', 148 click_date datetime DEFAULT CURRENT_TIMESTAMP NOT NULL, 149 user_ip varchar(45), 150 user_agent text, 151 page_url text, 152 PRIMARY KEY (id), 153 KEY button_id (button_id), 154 KEY click_date (click_date) 155 ) $charset_collate;"; 156 157 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 158 dbDelta($sql); 159 } 160 } 161 162 /** 126 163 * Aggiungi menu admin 127 164 */ … … 412 449 } 413 450 414 return ($current_time >= $day_schedule['start'] && $current_time < =$day_schedule['end']);451 return ($current_time >= $day_schedule['start'] && $current_time < $day_schedule['end']); 415 452 } 416 453 … … 715 752 global $wpdb; 716 753 754 // Assicurati che la tabella esista 755 $this->ensure_stats_table_exists(); 756 717 757 // Ottieni periodo selezionato 718 758 // phpcs:ignore WordPress.Security.NonceVerification.Recommended … … 1071 1111 1072 1112 global $wpdb; 1113 1114 // Assicurati che la tabella esista 1115 $this->ensure_stats_table_exists(); 1116 1073 1117 $table_stats = $wpdb->prefix . 'mametech_cb_stats'; 1074 1118 -
mametech-chat-button/trunk/readme.txt
r3444879 r3444913 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 2.1. 26 Stable tag: 2.1.3 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 111 111 112 112 == Changelog == 113 114 = 2.1.3 = 115 * Fixed: Statistics table auto-creation - now creates automatically if missing 116 * Fixed: Statistics now work even if activation hook failed 117 * Improved: Auto-repair mechanism for stats table 118 * Added: ensure_stats_table_exists() function for reliability 113 119 114 120 = 2.1.2 =
Note: See TracChangeset
for help on using the changeset viewer.