Changeset 3461137
- Timestamp:
- 02/14/2026 12:58:22 AM (6 weeks ago)
- Location:
- smt-toolkit/trunk
- Files:
-
- 12 edited
-
includes/class-smt-admin.php (modified) (9 diffs)
-
includes/class-smt-module-loader.php (modified) (4 diffs)
-
includes/modules/discounts/admin-view.php (modified) (1 diff)
-
includes/modules/discounts/assets/css/discounts-admin.css (modified) (1 diff)
-
includes/modules/discounts/assets/js/discounts-admin.js (modified) (7 diffs)
-
includes/modules/discounts/class-discounts-ajax.php (modified) (1 diff)
-
includes/modules/discounts/class-discounts-cron.php (modified) (1 diff)
-
includes/modules/discounts/class-discounts-module.php (modified) (1 diff)
-
includes/modules/discounts/class-discounts-svg.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
-
smt-toolkit.php (modified) (2 diffs)
-
uninstall.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smt-toolkit/trunk/includes/class-smt-admin.php
r3439002 r3461137 41 41 SMTTOOL_URL . 'assets/css/admin.css', 42 42 [], 43 '1.0.0'43 SMTTOOL_VERSION 44 44 ); 45 45 wp_enqueue_script( … … 47 47 SMTTOOL_URL . 'assets/js/admin.js', 48 48 ['jquery'], 49 '1.0.0',49 SMTTOOL_VERSION, 50 50 true 51 51 ); … … 77 77 SMTTOOL_URL . 'includes/modules/transliteration/assets/css/translit-admin.css', 78 78 ['smttool-admin'], 79 '1.0.0'79 SMTTOOL_VERSION 80 80 ); 81 81 … … 84 84 SMTTOOL_URL . 'includes/modules/transliteration/assets/js/translit-admin.js', 85 85 ['jquery', 'smttool-admin'], 86 '1.0.0',86 SMTTOOL_VERSION, 87 87 true 88 88 ); … … 99 99 SMTTOOL_URL . 'includes/modules/discounts/assets/css/discounts-admin.css', 100 100 ['smttool-admin'], 101 '1.0.0'101 SMTTOOL_VERSION 102 102 ); 103 103 … … 108 108 SMTTOOL_URL . 'includes/modules/discounts/assets/js/discounts-admin.js', 109 109 ['jquery', 'smttool-admin'], 110 '1.0.0',110 SMTTOOL_VERSION, 111 111 true 112 112 ); … … 124 124 ]); 125 125 break; 126 127 case 'store_settings': 128 wp_enqueue_style( 129 'smttool-store-settings-admin', 130 SMTTOOL_URL . 'includes/modules/store-settings/assets/css/store-settings-admin.css', 131 ['smttool-admin'], 132 SMTTOOL_VERSION 133 ); 134 135 wp_enqueue_script( 136 'smttool-store-settings-admin', 137 SMTTOOL_URL . 'includes/modules/store-settings/assets/js/store-settings-admin.js', 138 ['smttool-admin'], 139 SMTTOOL_VERSION, 140 true 141 ); 142 143 wp_localize_script( 144 'smttool-store-settings-admin', 145 'SMTTOOL_STORE_SETTINGS', 146 [ 147 'ajax' => [ 148 'url' => admin_url('admin-ajax.php'), 149 'nonce' => wp_create_nonce('smttool_store_settings_nonce'), 150 ], 151 ] 152 ); 153 break; 126 154 127 155 case 'gdi': … … 130 158 SMTTOOL_URL . 'includes/modules/google-drive-importer/assets/css/gdi-admin.css', 131 159 ['smttool-admin'], 132 '1.0.0'160 SMTTOOL_VERSION 133 161 ); 134 162 … … 137 165 SMTTOOL_URL . 'includes/modules/google-drive-importer/assets/js/gdi-admin.js', 138 166 ['jquery', 'smttool-admin'], 139 '1.0.0',167 SMTTOOL_VERSION, 140 168 true 141 169 ); -
smt-toolkit/trunk/includes/class-smt-module-loader.php
r3439002 r3461137 45 45 'requires' => 'woocommerce', 46 46 ], 47 'store_settings' => [ 48 'file' => SMTTOOL_PATH . 'includes/modules/store-settings/class-store-settings-module.php', 49 'class' => 'SMTTOOL_Store_Settings_Module', 50 'title' => 'Store Configuration', 51 'description' => 'Centralized store behavior, performance and UI configuration.', 52 'icon' => 'dashicons-admin-generic', 53 'requires' => 'woocommerce', 54 ], 47 55 ]; 48 56 } … … 61 69 } 62 70 63 // 🔹Dependency check71 // Dependency check 64 72 if (($mod['requires'] ?? '') === 'woocommerce' && !class_exists('WooCommerce')) { 65 73 continue; … … 78 86 $class = $mod['class']; 79 87 80 // 🔹DB install / upgrade (module-owned)88 // DB install / upgrade (module-owned) 81 89 if ( 82 90 method_exists($class, 'install') && … … 96 104 } 97 105 98 // 🔹Init module106 // Init module 99 107 $instance = new $class(); 100 108 -
smt-toolkit/trunk/includes/modules/discounts/admin-view.php
r3439002 r3461137 68 68 <tbody id="smt-discounts-table-body"> 69 69 70 <?php if (!empty($profiles)) : foreach ($profiles as $p) : ?> 70 <?php // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 71 if (!empty($profiles)) : foreach ($profiles as $p) : ?> 71 72 72 73 <tr data-id="<?php echo esc_attr($p['id']); ?>"> -
smt-toolkit/trunk/includes/modules/discounts/assets/css/discounts-admin.css
r3439002 r3461137 220 220 margin-left: 10px; 221 221 padding: 4px 10px; 222 border: 1px solid #ddd; 222 223 border-radius: 8px; 223 background: #4e8cff;224 color: # fff;224 background: transparent; 225 color: #111; 225 226 font-size: 13px; 226 227 } -
smt-toolkit/trunk/includes/modules/discounts/assets/js/discounts-admin.js
r3439002 r3461137 32 32 }); 33 33 34 // ⛔️ міняємо ТІЛЬКИ якщо значення реально невалідне35 34 if (!$op.find(`option[value="${$op.val()}"]:visible`).length) { 36 35 $op.val(allowed[0]); … … 212 211 const $values = $row.find('.smt-rule-values'); 213 212 214 // 🧹 ОЧИЩАЄМО СТАРІ ДАНІ215 213 $tags.empty(); 216 214 $values.val('[]'); … … 221 219 updateOperators($row); 222 220 223 // 🔁 Переініціалізація autocomplete224 221 initRuleAutocomplete($row); 225 222 }); … … 250 247 row.remove(); 251 248 252 // якщо видалили останній — новий останній ховає AND/OR253 249 if (isLast) { 254 250 $('.smt-discount-rule-row').last() … … 276 272 }); 277 273 278 // 🔑 SVG reflow hack (обовʼязково)274 // SVG reflow hack 279 275 $preview.find('svg use').each(function () { 280 276 const $use = $(this); … … 338 334 const $row = addRuleRow(); 339 335 340 // Виставляємо тип правила341 336 $row.find('[name="rules[][condition_type]"]').val(r.condition_type); 342 337 updateOperators($row); 343 338 344 // Виставляємо оператор345 339 $row.find('[name="rules[][operator]"]').val(r.operator); 346 347 // Виставляємо AND / OR348 340 $row.find('[name="rules[][logic_op]"]').val(r.logic_op || 'and'); 349 341 350 // ТІЛЬКИ ТЕПЕР ініціалізуємо autocomplete / price351 342 initRuleAutocomplete($row); 352 343 … … 382 373 }); 383 374 }); 384 385 $(document).on('click', '#smt-discounts-cancel', function () { 386 $('#smt-discounts-modal').fadeOut(150); 375 376 $(document).on('click', '#smt-discounts-cancel', function () { 377 const modal = $('#smt-discounts-modal'); 378 const form = modal.find('form'); 379 380 form[0].reset(); 381 form.find('[name=id]').val(''); 382 $('#smt-discounts-rules').empty(); 383 384 modal.fadeOut(150); 387 385 }); 388 386 -
smt-toolkit/trunk/includes/modules/discounts/class-discounts-ajax.php
r3439002 r3461137 235 235 236 236 // --- badge fields --- 237 $badge_text_raw = wp_kses_post($post['badge_text'] ?? '');237 $badge_text_raw = trim((string)($post['badge_text'] ?? '')); 238 238 $badge_text_color = sanitize_hex_color($post['badge_text_color'] ?? ''); 239 239 $badge_bg_color = sanitize_hex_color($post['badge_bg_color'] ?? ''); -
smt-toolkit/trunk/includes/modules/discounts/class-discounts-cron.php
r3439002 r3461137 527 527 return false; 528 528 } 529 530 $regular = (float)$regular; 529 530 $decimals = wc_get_price_decimals(); 531 532 $regular = (float) wc_format_decimal($regular, $decimals); 533 534 // Read current state once 535 $cur_price = get_post_meta($product_id, '_price', true); 536 $cur_sale = get_post_meta($product_id, '_sale_price', true); 537 $cur_from = get_post_meta($product_id, '_sale_price_dates_from', true); 538 $cur_to = get_post_meta($product_id, '_sale_price_dates_to', true); 539 $cur_profile = (int) get_post_meta($product_id, $meta_profile, true); 540 541 $changed = false; 531 542 532 543 if ($profile) { 533 544 534 $discount = (float)($profile['discount_value'] ?? 0); 535 if ($discount <= 0) return false; 536 537 $new_price = ($profile['discount_type'] === 'fixed') 545 $discount = (float) ($profile['discount_value'] ?? 0); 546 if ($discount <= 0) { 547 return false; 548 } 549 550 $type = (string) ($profile['discount_type'] ?? ''); 551 $new_price = ($type === 'fixed') 538 552 ? max(0, $regular - $discount) 539 553 : max(0, $regular * (1 - $discount / 100)); 540 541 update_post_meta($product_id, '_sale_price', $new_price); 542 update_post_meta($product_id, '_price', $new_price); 543 554 555 $new_price = (float) wc_format_decimal($new_price, $decimals); 556 557 $cur_price = (float) wc_format_decimal($cur_price, $decimals); 558 $cur_sale = (float) wc_format_decimal($cur_sale, $decimals); 559 560 // Dates 544 561 $date_from = strtotime(($profile['date_start'] ?? '') . ' ' . ($profile['time_start'] ?: '00:00:00')); 545 562 $date_to = strtotime(($profile['date_end'] ?? '') . ' ' . ($profile['time_end'] ?: '23:59:59')); 546 563 547 $date_from ? update_post_meta($product_id, '_sale_price_dates_from', $date_from) 548 : delete_post_meta($product_id, '_sale_price_dates_from'); 549 550 $date_to ? update_post_meta($product_id, '_sale_price_dates_to', $date_to) 551 : delete_post_meta($product_id, '_sale_price_dates_to'); 552 553 update_post_meta($product_id, $meta_profile, (int)$profile['id']); 554 555 wc_delete_product_transients($product_id); 556 return true; 564 $new_profile_id = (int) ($profile['id'] ?? 0); 565 566 // 1) _sale_price 567 if ($cur_sale !== $new_price) { 568 update_post_meta($product_id, '_sale_price', $new_price); 569 $changed = true; 570 } 571 572 // 2) _price (should match sale during active discount) 573 if ($cur_price !== $new_price) { 574 update_post_meta($product_id, '_price', $new_price); 575 $changed = true; 576 } 577 578 // 3) dates_from 579 $cur_from_i = $cur_from !== '' ? (int)$cur_from : 0; 580 $new_from_i = $date_from ? (int)$date_from : 0; 581 if ($cur_from_i !== $new_from_i) { 582 $new_from_i ? update_post_meta($product_id, '_sale_price_dates_from', $new_from_i) 583 : delete_post_meta($product_id, '_sale_price_dates_from'); 584 $changed = true; 585 } 586 587 // 4) dates_to 588 $cur_to_i = $cur_to !== '' ? (int)$cur_to : 0; 589 $new_to_i = $date_to ? (int)$date_to : 0; 590 if ($cur_to_i !== $new_to_i) { 591 $new_to_i ? update_post_meta($product_id, '_sale_price_dates_to', $new_to_i) 592 : delete_post_meta($product_id, '_sale_price_dates_to'); 593 $changed = true; 594 } 595 596 // 5) active profile marker 597 if ($cur_profile !== $new_profile_id) { 598 update_post_meta($product_id, $meta_profile, $new_profile_id); 599 $changed = true; 600 } 601 602 if ($changed) { 603 wc_delete_product_transients($product_id); 604 } 605 606 return $changed; 557 607 558 608 } else { 559 609 560 $current_profile_id = get_post_meta($product_id, $meta_profile, true); 561 if (!$current_profile_id) return false; 562 563 update_post_meta($product_id, '_price', $regular); 564 565 delete_post_meta($product_id, '_sale_price'); 566 delete_post_meta($product_id, '_sale_price_dates_from'); 567 delete_post_meta($product_id, '_sale_price_dates_to'); 610 if (!$cur_profile) { 611 return false; 612 } 613 614 // Restore _price to regular if needed 615 if (!$eq_price($cur_price, $regular)) { 616 update_post_meta($product_id, '_price', $regular); 617 $changed = true; 618 } 619 620 // Remove sale meta only if exists 621 if ($cur_sale !== '' && $cur_sale !== null) { 622 delete_post_meta($product_id, '_sale_price'); 623 $changed = true; 624 } 625 if ($cur_from !== '' && $cur_from !== null) { 626 delete_post_meta($product_id, '_sale_price_dates_from'); 627 $changed = true; 628 } 629 if ($cur_to !== '' && $cur_to !== null) { 630 delete_post_meta($product_id, '_sale_price_dates_to'); 631 $changed = true; 632 } 633 568 634 delete_post_meta($product_id, $meta_profile); 569 570 wc_delete_product_transients($product_id); 571 return true; 635 $changed = true; 636 637 if ($changed) { 638 wc_delete_product_transients($product_id); 639 } 640 641 return $changed; 572 642 } 573 643 } -
smt-toolkit/trunk/includes/modules/discounts/class-discounts-module.php
r3439002 r3461137 59 59 discount_type ENUM('percent','fixed') NOT NULL DEFAULT 'percent', 60 60 discount_value DECIMAL(10,2) NOT NULL DEFAULT 0, 61 badge_text VARCHAR(100)NULL,61 badge_text MEDIUMTEXT NULL, 62 62 badge_text_color VARCHAR(20) NULL, 63 63 badge_bg_color VARCHAR(20) NULL, -
smt-toolkit/trunk/includes/modules/discounts/class-discounts-svg.php
r3439002 r3461137 6 6 public static function init() { 7 7 add_action('wp_footer', [__CLASS__, 'discounts_badge']); 8 add_filter('woocommerce_sale_flash', [__CLASS__, 'render_discount_badge'], 9999, 3); 9 add_action( 'wp_enqueue_scripts', [ __CLASS__, 'enqueue_badge_script' ] ); 8 9 $modules = get_option('smttool_modules', []); 10 $settings = get_option('smttool_store_settings', []); 11 12 $store_settings_enabled = !empty($modules['store_settings']['enabled']); 13 $onsale_badge_enabled = !empty($settings['badges']['onsale']['enabled']); 14 15 if ($store_settings_enabled && $onsale_badge_enabled) { 16 add_filter('smttool_sale_badge', [__CLASS__, 'render_discount_badge'], 9999, 3); 17 } else { 18 add_filter('woocommerce_sale_flash', [__CLASS__, 'render_discount_badge'], 9999, 3); 19 } 10 20 } 11 21 … … 16 26 17 27 $html = trim($html); 18 if ($html === '') return ''; 28 if ($html === '') { 29 return ''; 30 } 31 32 if (strlen($html) > 20000) { 33 return ''; 34 } 19 35 20 $html = wp_kses($html, [ 21 'svg' => [ 22 'xmlns' => true, 23 'viewBox' => true, 24 'width' => true, 25 'height'=> true, 26 'fill' => true, 27 'class' => true, 28 ], 29 'path' => [ 30 'd' => true, 31 'fill' => true, 32 ], 33 'span' => [ 34 'class' => true, 35 'style' => true, 36 ], 37 'b' => [], 38 'i' => [], 39 'strong' => [], 40 ]); 36 // --- SVG --- 37 if (preg_match('/^\s*<svg\b/i', $html)) { 38 return self::optimize_svg($html); 39 } 41 40 42 $html = preg_replace('/\s{2,}/', ' ', $html); 43 $html = str_replace(["\n", "\r", "\t"], '', $html); 41 // --- Font Awesome / icon fonts --- 42 if (preg_match('/^\s*<(i|span)\b/i', $html)) { 43 return wp_kses($html, [ 44 'i' => [ 45 'class' => true, 46 'aria-hidden' => true, 47 ], 48 'span' => [ 49 'class' => true, 50 ], 51 ]); 52 } 44 53 45 return trim($html); 54 // --- Plain text / emoji --- 55 return sanitize_text_field($html); 56 } 57 58 protected static function optimize_svg(string $svg): string { 59 60 // Remove XML / DOCTYPE 61 $svg = preg_replace('/<\?xml.*?\?>/i', '', $svg); 62 $svg = preg_replace('/<!DOCTYPE.*?>/i', '', $svg); 63 64 // Remove scripts & foreignObject (XSS) 65 $svg = preg_replace('#<script.*?</script>#is', '', $svg); 66 $svg = preg_replace('#<foreignObject.*?</foreignObject>#is', '', $svg); 67 68 // Remove on* attributes 69 $svg = preg_replace('/\son\w+="[^"]*"/i', '', $svg); 70 $svg = preg_replace("/\son\w+='[^']*'/i", '', $svg); 71 72 // Remove javascript: links 73 $svg = preg_replace('/xlink:href="javascript:[^"]*"/i', '', $svg); 74 $svg = preg_replace('/href="javascript:[^"]*"/i', '', $svg); 75 76 // Remove comments 77 $svg = preg_replace('/<!--.*?-->/s', '', $svg); 78 79 // Minify whitespace 80 $svg = preg_replace('/>\s+</', '><', $svg); 81 $svg = preg_replace('/\s{2,}/', ' ', $svg); 82 $svg = preg_replace('/\s*=\s*/', '=', $svg); 83 84 return trim($svg); 46 85 } 47 86 48 87 /** 49 * jsfooter.88 * footer. 50 89 */ 51 90 public static function discounts_badge() { … … 53 92 $profiles = SMTTOOL_Discounts_Module::get_active_profiles(); 54 93 if (!$profiles) return; 94 95 $huge_svg = false; 55 96 56 97 foreach ($profiles as $profile) { 57 98 58 if (empty($profile['badge_text'])) continue; 99 $badge = $profile['badge_text']; 100 if (empty($badge) || strlen($badge) < 2000) continue; 59 101 60 $style = ''; 61 if (!empty($profile['badge_text_color'])) { 62 $style .= 'color:' . esc_attr($profile['badge_text_color']) . ';'; 63 } 64 if (!empty($profile['badge_bg_color'])) { 65 $style .= 'background:' . esc_attr($profile['badge_bg_color']) . ';'; 66 } 67 68 echo '<template id="smt-badge-profile-' . (int)$profile['id'] . '">'; 69 echo '<span class="onsale smt-discount-badge" style="' . esc_attr($style) . '">'; 70 echo esc_html( $profile['badge_text'] ); 71 echo '</span>'; 102 $huge_svg = true; 103 echo '<template id="smt-badge-onsale-' . (int)$profile['id'] . '">'; 104 echo $badge; 72 105 echo '</template>'; 106 } 107 108 if ($huge_svg && !wp_script_is('smttool-badge', 'enqueued')) { 109 self::enqueue_badge_script(); 73 110 } 74 111 } … … 76 113 public static function enqueue_badge_script() { 77 114 78 $profiles = SMTTOOL_Discounts_Module::get_active_profiles(); 79 if ( ! $profiles ) { 80 return; 81 } 115 wp_register_script('smttool-badge', '', [], '1.0.0', true); 82 116 83 wp_register_script('smttool-discount-badge', '', [], '1.0.0', true); 84 85 wp_enqueue_script( 'smttool-discount-badge' ); 117 wp_enqueue_script( 'smttool-badge' ); 86 118 87 119 wp_add_inline_script( 88 'smttool- discount-badge',120 'smttool-badge', 89 121 '(function () { 90 122 const apply = root => { 91 root.querySelectorAll(".smt- discount-badge[data-profile]").forEach(el => {123 root.querySelectorAll(".smt-badge[data-badge]").forEach(el => { 92 124 if (el.dataset.applied) return; 93 const tpl = document.getElementById("smt-badge- profile-" + el.dataset.profile);125 const tpl = document.getElementById("smt-badge-" + el.dataset.badge); 94 126 if (!tpl) return; 95 el.replaceWith(tpl.content.cloneNode(true)); 127 el.appendChild(tpl.content.cloneNode(true)); 128 el.dataset.applied = "1"; 96 129 }); 97 130 }; … … 128 161 return $html; 129 162 } 130 return preg_replace( 131 '#<span([^>]*)class="([^"]*onsale[^"]*)"([^>]*)>.*?</span>#i', 132 '<span class="onsale smt-discount-badge" data-profile="' . esc_attr($profile_id) . '"></span>', 133 $html 134 ); 163 164 $profile = SMTTOOL_Discounts_Module::get_profile($profile_id); 165 $badge = $profile['badge_text']; 166 if (empty($badge)) { 167 return $html; 168 } 169 170 $style = ''; 171 if (!empty($profile['badge_text_color'])) { 172 $style .= 'color:' . esc_attr($profile['badge_text_color']) . ';'; 173 } 174 if (!empty($profile['badge_bg_color'])) { 175 $style .= 'background:' . esc_attr($profile['badge_bg_color']) . ';'; 176 } 177 178 if (strlen($badge) > 2000) { 179 return '<span class="smt-badge onsale" data-badge="onsale-' . esc_attr($profile_id) . '" style="' . esc_attr($style) . '"></span>'; 180 } else { 181 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- 182 // To allow sanitized svg and html and intentionally printed raw. 183 return '<span class="smt-badge onsale" data-badge="onsale" style="' . esc_attr($style) . '">' . $badge . '</span>'; 184 } 185 135 186 } 136 187 } -
smt-toolkit/trunk/readme.txt
r3439002 r3461137 5 5 Requires at least: 5.8 6 6 Tested up to: 6.9 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 114 114 --- 115 115 116 Store Settings Module 117 118 The Store Settings module centralizes WooCommerce configuration in one place — no need to edit theme files or functions.php. 119 120 It allows you to safely manage store behavior, performance tweaks, product badges, and Classic checkout fields through a clean admin interface. 121 122 **Key Features** 123 - Disable unused frontend scripts and styles 124 - Add context-based inline CSS and JavaScript 125 - Clean up unnecessary WordPress and WooCommerce head output 126 - Configure product badges (Sale, New, Sold Out, Featured, Best Seller) 127 - Customize Classic WooCommerce checkout fields 128 129 Checkout customization works with Classic WooCommerce checkout (shortcode). 130 Blocks checkout is automatically detected. 131 132 --- 133 116 134 ### Modular Architecture 117 135 … … 186 204 187 205 == Changelog == 206 207 = 1.0.1 = 208 * Added Store Settings module (assets control, cleanup, inline CSS/JS, checkout fields) 209 * Checkout customization refactored (Classic checkout only, Block checkout detection added) 210 * Fixed WooCommerce checkout field re-rendering (wc-checkout handling) 211 * Improved checkout field diff-based saving (no translation overwrite) 212 * Added reset option for checkout fields 213 * Enhanced badge system (heavy SVG handling, template injection, mutation observer) 214 * Optimized best-seller query with transient caching 215 * Improved security sanitization (wp_unslash handling, SVG hardening) 216 * Added advanced cleanup options (WooCommerce blocks, cart fragments, brands) 217 * Performance improvements and codebase stabilization 218 * Multiple security and Plugin Check compliance fixes 188 219 189 220 = 1.0.0 = -
smt-toolkit/trunk/smt-toolkit.php
r3439002 r3461137 3 3 * Plugin Name: SMT Toolkit for WooCommerce 4 4 * Description: Modular toolkit for store automation: imports, discounts, transliteration and cron-based workflows. 5 * Version: 1.0. 05 * Version: 1.0.1 6 6 * Author: limchik 7 7 * Text Domain: smt-toolkit … … 20 20 define('SMTTOOL_PATH', plugin_dir_path(__FILE__)); 21 21 define('SMTTOOL_URL', plugin_dir_url(__FILE__)); 22 define('SMTTOOL_VERSION', '1.0.1'); 22 23 23 24 /** -
smt-toolkit/trunk/uninstall.php
r3439002 r3461137 17 17 18 18 // Remove GDI logs directory 19 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 19 20 $upload = wp_upload_dir(); 21 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 20 22 $dir = trailingslashit( $upload['basedir'] ) . 'smttool-gdi-logs/'; 21 23 … … 26 28 delete_option( 'smttool_gdi_profiles' ); 27 29 30 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 28 31 global $wpdb; 29 32 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 30 33 $like = $wpdb->esc_like( 'smttool_gdi_last_' ) . '%'; 31 34 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching … … 38 41 39 42 if ( $keys ) { 43 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 40 44 foreach ( $keys as $key ) { 41 45 delete_option( $key ); … … 45 49 1. Remove options 46 50 ===================================================== */ 47 51 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 48 52 $option_prefixes = [ 49 53 'smttool_', 50 54 ]; 51 55 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 52 56 foreach ($option_prefixes as $prefix) { 53 57 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
Note: See TracChangeset
for help on using the changeset viewer.