From 876b9cd005f7f6341ec4624b078085f58da0d4c6 Mon Sep 17 00:00:00 2001 From: Git Manager GUI Date: Mon, 11 May 2026 12:00:52 +0200 Subject: [PATCH] Upload via Git Manager GUI --- wp-ingame-shop/wp-ingame-shop-pro.php | 1043 +++++++++++++++++++++---- 1 file changed, 882 insertions(+), 161 deletions(-) diff --git a/wp-ingame-shop/wp-ingame-shop-pro.php b/wp-ingame-shop/wp-ingame-shop-pro.php index fa7b671..0c150ec 100644 --- a/wp-ingame-shop/wp-ingame-shop-pro.php +++ b/wp-ingame-shop/wp-ingame-shop-pro.php @@ -772,6 +772,31 @@ class WIS_Activator { self::create_default_categories(); return true; } + + public static function reset_sell_log(): bool { + global $wpdb; + $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}wis_sell_log"); + return true; + } + + public static function reset_top_spenders(): bool { + global $wpdb; + $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}wis_orders"); + return true; + } + + public static function reset_analyse(): bool { + global $wpdb; + // Order-Items-Tabelle (Analyse-Grundlage) leeren + $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}wis_order_items"); + return true; + } + + public static function reset_price_history(): bool { + global $wpdb; + $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}wis_price_history"); + return true; + } } // =========================================================== @@ -1381,7 +1406,15 @@ class WIS_Admin { global $wpdb; $item_type = sanitize_text_field($_POST['item_type'] ?? 'minecraft'); - if ($item_type === 'fly') { + if ($item_type === 'gift_card') { + $gc_min = max(1, intval($_POST['gift_card_min'] ?? 100)); + $gc_max = max($gc_min, intval($_POST['gift_card_max'] ?? 5000)); + // item_id kodiert Min+Max – eindeutig und vom create_order erkennbar + $resolved_item_id = 'gift_card_' . $gc_min . '_' . $gc_max; + $_POST['item_id'] = $resolved_item_id; + // Preis = Mindestwert (wird im Frontend durch Nutzereingabe überschrieben) + $_POST['price'] = $gc_min; + } elseif ($item_type === 'fly') { $resolved_item_id = sanitize_text_field($_POST['fly_duration'] ?? 'fly_5min'); } elseif ($item_type === 'rank') { $rank_id = preg_replace('/[^a-z0-9_\-]/', '', strtolower($_POST['rank_id'] ?? 'vip')); @@ -1435,7 +1468,7 @@ class WIS_Admin { 'sell_price_mode' => in_array($_POST['sell_price_mode'] ?? '', ['percent','fixed','minus']) ? $_POST['sell_price_mode'] : 'percent', 'sell_price_value' => max(0, intval($_POST['sell_price_value'] ?? 80)), 'daily_sell_limit' => max(0, intval($_POST['daily_sell_limit'] ?? 0)), - 'status' => (intval($_POST['price'] ?? 0) > 0 || $item_type === 'fly' || $item_type === 'rank' || $item_type === 'fly_abo' || $item_type === 'plot_slots' || $item_type === 'plot_abo' || $item_type === 'item_abo' || $item_type === 'custom_cmd') ? 'publish' : 'draft', + 'status' => (intval($_POST['price'] ?? 0) > 0 || $item_type === 'fly' || $item_type === 'rank' || $item_type === 'fly_abo' || $item_type === 'plot_slots' || $item_type === 'plot_abo' || $item_type === 'item_abo' || $item_type === 'custom_cmd' || $item_type === 'gift_card') ? 'publish' : 'draft', ]; // Preishistorie loggen wenn ein bestehendes Item bearbeitet wird @@ -1516,6 +1549,7 @@ class WIS_Admin { add_submenu_page('wis_shop', 'Top Spender', 'Top Spender', 'manage_options', 'wis_top_spenders', [self::class, 'page_top_spenders']); add_submenu_page('wis_shop', 'Ankauf-Log', 'Ankauf-Log', 'manage_options', 'wis_sell_log', [self::class, 'page_sell_log']); add_submenu_page('wis_shop', 'Preishistorie', 'Preishistorie', 'manage_options', 'wis_price_history', [self::class, 'page_price_history']); + add_submenu_page('wis_shop', 'Abo-Verwaltung', 'Abo-Verwaltung', 'manage_options', 'wis_abo_admin', [self::class, 'page_abo_admin']); add_submenu_page('wis_shop', 'JSON Export/Import', 'JSON Tools', 'manage_options', 'wis_json', [self::class, 'page_json']); add_submenu_page('wis_shop', 'Shop Reset', 'Reset', 'manage_options', 'wis_reset', [self::class, 'page_reset']); } @@ -2219,7 +2253,8 @@ class WIS_Admin { $cur_abo_item_id = $is_item_abo ? $ia_m[1] : 'minecraft:stone'; $cur_abo_daily_qty = $is_item_abo ? intval($ia_m[2]) : 1; $cur_abo_duration = $is_item_abo ? intval($ia_m[3]) : 30; - $detected_type = $is_fly ? 'fly' : (($is_rank || $is_rank_old) ? 'rank' : ($is_fly_abo ? 'fly_abo' : ($is_plot_slots ? 'plot_slots' : ($is_plot_abo ? 'plot_abo' : ($is_item_abo ? 'item_abo' : ($is_custom_cmd ? 'custom_cmd' : 'minecraft')))))); + $is_gift_card = $item && str_starts_with($item->item_id, 'gift_card'); + $detected_type = $is_fly ? 'fly' : (($is_rank || $is_rank_old) ? 'rank' : ($is_fly_abo ? 'fly_abo' : ($is_plot_slots ? 'plot_slots' : ($is_plot_abo ? 'plot_abo' : ($is_item_abo ? 'item_abo' : ($is_custom_cmd ? 'custom_cmd' : ($is_gift_card ? 'gift_card' : 'minecraft'))))))); ?>
@@ -2413,6 +2449,38 @@ class WIS_Admin {

+ + +