feat: Add banner management functionality

- Implemented a new Banner model to represent banner data.
- Created a BannerRepository for database interactions related to banners.
- Developed a BannerService to handle business logic for banners.
- Added admin views for listing and adding banners.
- Integrated banner hooks for frontend rendering and click tracking.
- Created frontend styles and scripts for banner display and interaction.
- Updated database migrations to include a new banners table.
- Enhanced AdminController to manage banner actions and pages.
This commit is contained in:
2026-05-05 01:03:05 +03:30
parent 5930c1ad6f
commit 32c065e4b6
15 changed files with 1350 additions and 4 deletions

View File

@@ -69,11 +69,34 @@ function sodino_create_tables() {
PRIMARY KEY (id)
) $charset_collate;";
// Banner table
$banner_table = $wpdb->prefix . 'sodino_banners';
$banner_sql = "CREATE TABLE $banner_table (
id mediumint(9) NOT NULL AUTO_INCREMENT,
title varchar(255) NOT NULL,
content_type varchar(50) NOT NULL DEFAULT 'image',
content_value longtext NOT NULL,
link_url varchar(255) DEFAULT NULL,
position varchar(50) NOT NULL DEFAULT 'top',
display_type varchar(50) NOT NULL DEFAULT 'inline',
start_time datetime DEFAULT NULL,
end_time datetime DEFAULT NULL,
user_target varchar(50) NOT NULL DEFAULT 'all',
device_target varchar(50) NOT NULL DEFAULT 'all',
priority int(11) NOT NULL DEFAULT 10,
status tinyint(1) NOT NULL DEFAULT 1,
impressions bigint(20) NOT NULL DEFAULT 0,
clicks bigint(20) NOT NULL DEFAULT 0,
created_at datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
) $charset_collate;";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($rules_sql);
dbDelta($events_sql);
dbDelta($upsell_sql);
dbDelta($banner_sql);
// Add version option
add_option('sodino_db_version', '1.2');
update_option('sodino_db_version', '1.3');
}