get_charset_collate(); $table_name = $wpdb->prefix . 'aio_audit_logs'; $sql = "CREATE TABLE $table_name ( id bigint(20) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, user_id bigint(20) NOT NULL, user_login varchar(60) NOT NULL, event varchar(100) NOT NULL, details text NOT NULL, ip_address varchar(45) NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); } register_activation_hook( __FILE__, 'aio_tools_activate' ); function run_aio_tools() { if( preg_match( '/(\.txt|\.pdf|\.xml|\.ico|\.gz|\/feed\/?)/', $_SERVER['REQUEST_URI'] ) ) {return;} $plugin = new AIO_Tools(); $plugin->run(); } run_aio_tools();