| @@ -1,11 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace RadiusTheme\SB\Models; |
| 4 | 4 | |
| 5 | -use RadiusTheme\SB\AI\AIFns; | |
| 6 | 5 | use RadiusTheme\SB\Helpers\Fns; |
| 7 | -use RadiusTheme\SB\Helpers\SvgIcons; | |
| 8 | 6 | use RadiusTheme\SB\Models\Base\ListModel; |
| 9 | 7 | use RadiusTheme\SB\Traits\SingletonTrait; |
| 10 | 8 | |
| 11 | 9 | defined( 'ABSPATH' ) || exit; |
| @@ -55,17 +53,12 @@ | ||
| 55 | 53 | 'optimization' => apply_filters( |
| 56 | 54 | 'rtsb/settings/optimization/options', |
| 57 | 55 | [ |
| 58 | 56 | 'id' => 'optimization', |
| 59 | - 'icon' => SvgIcons::get( 'optimization' ), | |
| 60 | 57 | 'category' => 'general', |
| 61 | 58 | 'title' => esc_html__( 'Advanced Optimizations', 'shopbuilder' ), |
| 62 | 59 | 'package' => $this->pro_version_checker(), |
| 63 | 60 | 'badge' => 'new', |
| 64 | - 'links' => [ | |
| 65 | - 'doc' => '', | |
| 66 | - 'video' => '', | |
| 67 | - ], | |
| 68 | 61 | 'active_field' => [ |
| 69 | 62 | 'disable' => true, |
| 70 | 63 | ], |
| 71 | 64 | 'fields' => [ |
| @@ -71,16 +64,15 @@ | ||
| 71 | 64 | 'fields' => [ |
| 72 | 65 | 'optimization_intro' => [ |
| 73 | 66 | 'id' => 'optimization_intro', |
| 74 | 67 | 'type' => 'description', |
| 75 | - 'text' => __( 'Optimize your website for maximum performance from these advanced options. <br /> <span style="color: #dc3545; display: block; margin-top: 10px;">⚠️ Note: After enabling or disabling any of these settings, clear the ShopBuilder cache to ensure changes are applied correctly.</span> <span style="color: #16a34a; display: block; margin-top: 10px;">✅ Recommended: Keep Asset Optimization enabled on live/production sites for faster loading. Turn it off only while troubleshooting or verifying a recent change.</span>', 'shopbuilder' ), | |
| 68 | + 'text' => __( 'Optimize your website for maximum performance from these advanced options. <br /> <span style="color: #dc3545; display: block; margin-top: 10px;">⚠️ Note: After enabling or disabling any of these settings, clear the ShopBuilder cache to ensure changes are applied correctly.</span>', 'shopbuilder' ), | |
| 76 | 69 | ], |
| 77 | 70 | 'enable_optimization' => [ |
| 78 | 71 | 'id' => 'enable', |
| 79 | 72 | 'type' => 'switch', |
| 80 | - 'value' => 'on', | |
| 81 | 73 | 'label' => esc_html__( 'Enable Asset Optimization?', 'shopbuilder' ), |
| 82 | - 'help' => esc_html__( 'Enable this option to dynamically load assets (styles, scripts) only when needed, helping to optimize your website\'s performance', 'shopbuilder' ), | |
| 74 | + 'help' => esc_html__( 'Enable this option to dynamically load assets (styles, scripts) only when needed, helping to optimize your website’s performance', 'shopbuilder' ), | |
| 83 | 75 | ], |
| 84 | 76 | 'load_elementor_scripts' => [ |
| 85 | 77 | 'id' => 'enable', |
| 86 | 78 | 'type' => 'switch', |
| @@ -139,17 +131,12 @@ | ||
| 139 | 131 | 'ai_implementation' => apply_filters( |
| 140 | 132 | 'rtsb/settings/ai_implementation/options', |
| 141 | 133 | [ |
| 142 | 134 | 'id' => 'ai_implementation', |
| 143 | - 'icon' => SvgIcons::get( 'ai_implementation' ), | |
| 144 | 135 | 'category' => 'general', |
| 145 | 136 | 'title' => esc_html__( 'AI-implementation', 'shopbuilder' ), |
| 146 | 137 | 'package' => 'free', |
| 147 | - 'badge' => 'beta', | |
| 148 | - 'links' => [ | |
| 149 | - 'doc' => '', | |
| 150 | - 'video' => '', | |
| 151 | - ], | |
| 138 | + 'badge' => 'new', | |
| 152 | 139 | 'active_field' => [ |
| 153 | 140 | 'disable' => true, |
| 154 | 141 | ], |
| 155 | 142 | 'fields' => [ |
| @@ -392,14 +379,17 @@ | ||
| 392 | 379 | ], |
| 393 | 380 | 'minimum_matching_percentage' => [ |
| 394 | 381 | 'id' => 'minimum_matching_percentage', |
| 395 | 382 | 'label' => esc_html__( 'Minimum Accuracy (in percentage)', 'shopbuilder' ), |
| 396 | - 'help' => esc_html__( 'Set the minimum Accuracy. It is good between 40 and 60', 'shopbuilder' ), | |
| 397 | 383 | 'type' => 'number', |
| 398 | 384 | 'min' => 1, |
| 399 | 385 | 'max' => 99, |
| 400 | - 'value' => 40, | |
| 401 | - 'placeholder' => esc_html__( '40', 'shopbuilder' ), | |
| 386 | + 'help' => esc_html__( | |
| 387 | + 'Set the minimum Accuracy.', | |
| 388 | + 'shopbuilder' | |
| 389 | + ), | |
| 390 | + 'value' => 99, | |
| 391 | + 'placeholder' => esc_html__( '99', 'shopbuilder' ), | |
| 402 | 392 | 'dependency' => [ |
| 403 | 393 | 'rules' => [ |
| 404 | 394 | [ |
| 405 | 395 | 'item' => 'general.ai_implementation.ai_tools', |
| @@ -438,16 +428,11 @@ | ||
| 438 | 428 | 'notification' => apply_filters( |
| 439 | 429 | 'rtsb/settings/notification/options', |
| 440 | 430 | [ |
| 441 | 431 | 'id' => 'notification', |
| 442 | - 'icon' => SvgIcons::get( 'notification' ), | |
| 443 | 432 | 'category' => 'general', |
| 444 | 433 | 'title' => esc_html__( 'Notification Settings', 'shopbuilder' ), |
| 445 | 434 | 'package' => 'free', |
| 446 | - 'links' => [ | |
| 447 | - 'doc' => '', | |
| 448 | - 'video' => '', | |
| 449 | - ], | |
| 450 | 435 | 'active_field' => [ |
| 451 | 436 | 'disable' => true, |
| 452 | 437 | ], |
| 453 | 438 | 'fields' => [ |
| @@ -514,16 +499,11 @@ | ||
| 514 | 499 | 'social_share' => apply_filters( |
| 515 | 500 | 'rtsb/settings/social_share/options', |
| 516 | 501 | [ |
| 517 | 502 | 'id' => 'social_share', |
| 518 | - 'icon' => SvgIcons::get( 'social_share' ), | |
| 519 | 503 | 'category' => 'general', |
| 520 | 504 | 'title' => esc_html__( 'Social Share Settings', 'shopbuilder' ), |
| 521 | 505 | 'package' => 'free', |
| 522 | - 'links' => [ | |
| 523 | - 'doc' => '', | |
| 524 | - 'video' => '', | |
| 525 | - ], | |
| 526 | 506 | 'active_field' => [ |
| 527 | 507 | 'disable' => true, |
| 528 | 508 | ], |
| 529 | 509 | 'fields' => [ |
| @@ -570,16 +550,11 @@ | ||
| 570 | 550 | 'guest_user' => apply_filters( |
| 571 | 551 | 'rtsb/settings/guest_user/options', |
| 572 | 552 | [ |
| 573 | 553 | 'id' => 'guest_user', |
| 574 | - 'icon' => SvgIcons::get( 'guest_user' ), | |
| 575 | 554 | 'category' => 'general', |
| 576 | 555 | 'title' => esc_html__( 'Guest User Controls', 'shopbuilder' ), |
| 577 | 556 | 'package' => $this->pro_package(), |
| 578 | - 'links' => [ | |
| 579 | - 'doc' => '', | |
| 580 | - 'video' => '', | |
| 581 | - ], | |
| 582 | 557 | 'active_field' => [ |
| 583 | 558 | 'disable' => true, |
| 584 | 559 | ], |
| 585 | 560 | ], |
| @@ -587,16 +562,11 @@ | ||
| 587 | 562 | 'tooltip' => apply_filters( |
| 588 | 563 | 'rtsb/settings/tooltip/options', |
| 589 | 564 | [ |
| 590 | 565 | 'id' => 'tooltip', |
| 591 | - 'icon' => SvgIcons::get( 'tooltip' ), | |
| 592 | 566 | 'category' => 'general', |
| 593 | 567 | 'title' => esc_html__( 'Tooltip Settings', 'shopbuilder' ), |
| 594 | 568 | 'package' => $this->pro_package(), |
| 595 | - 'links' => [ | |
| 596 | - 'doc' => '', | |
| 597 | - 'video' => '', | |
| 598 | - ], | |
| 599 | 569 | 'active_field' => [ |
| 600 | 570 | 'disable' => true, |
| 601 | 571 | ], |
| 602 | 572 | ], |
| @@ -604,16 +574,11 @@ | ||
| 604 | 574 | 'billing_form' => apply_filters( |
| 605 | 575 | 'rtsb/settings/billing_form/options', |
| 606 | 576 | [ |
| 607 | 577 | 'id' => 'billing_form', |
| 608 | - 'icon' => SvgIcons::get( 'billing_form' ), | |
| 609 | 578 | 'category' => 'checkout', |
| 610 | 579 | 'title' => esc_html__( 'Billing Form Settings', 'shopbuilder' ), |
| 611 | 580 | 'package' => 'free', |
| 612 | - 'links' => [ | |
| 613 | - 'doc' => '', | |
| 614 | - 'video' => '', | |
| 615 | - ], | |
| 616 | 581 | 'active_field' => [ |
| 617 | 582 | 'label' => esc_html__( 'Customize Billing Form Fields?', 'shopbuilder' ), |
| 618 | 583 | 'help' => esc_html__( 'Switch on to customize billing form fields.', 'shopbuilder' ), |
| 619 | 584 | ], |
| @@ -618,13 +583,12 @@ | ||
| 618 | 583 | 'help' => esc_html__( 'Switch on to customize billing form fields.', 'shopbuilder' ), |
| 619 | 584 | ], |
| 620 | 585 | 'fields' => [ |
| 621 | 586 | 'checkout_billing_info' => [ |
| 622 | - 'id' => 'checkout_billing_info', | |
| 623 | - 'type' => 'deprecated', | |
| 624 | - 'label' => __( '<strong>Deprecated:</strong> Billing Form Settings is deprecated. Please use the <strong><u>Checkout Fields Editor</u></strong> module to customize checkout fields. These settings will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is active.', 'shopbuilder' ), | |
| 625 | - 'customClass' => 'checkout-notice', | |
| 626 | - 'before_active' => true, | |
| 587 | + 'id' => 'checkout_billing_info', | |
| 588 | + 'type' => 'title', | |
| 589 | + 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ), | |
| 590 | + 'customClass' => 'checkout-notice', | |
| 627 | 591 | ], |
| 628 | 592 | 'billing_first_name_heading' => [ |
| 629 | 593 | 'id' => 'billing_first_name_heading', |
| 630 | 594 | 'type' => 'title', |
| @@ -1219,16 +1183,11 @@ | ||
| 1219 | 1183 | 'shipping_form' => apply_filters( |
| 1220 | 1184 | 'rtsb/module/shipping_form/options', |
| 1221 | 1185 | [ |
| 1222 | 1186 | 'id' => 'shipping_form', |
| 1223 | - 'icon' => SvgIcons::get( 'shipping_form' ), | |
| 1224 | 1187 | 'category' => 'checkout', |
| 1225 | 1188 | 'title' => esc_html__( 'Shipping Form Settings', 'shopbuilder' ), |
| 1226 | 1189 | 'package' => 'free', |
| 1227 | - 'links' => [ | |
| 1228 | - 'doc' => '', | |
| 1229 | - 'video' => '', | |
| 1230 | - ], | |
| 1231 | 1190 | 'active_field' => [ |
| 1232 | 1191 | 'label' => esc_html__( 'Customize Shipping form Fields?', 'shopbuilder' ), |
| 1233 | 1192 | 'help' => esc_html__( 'Switch on to customize shipping form fields.', 'shopbuilder' ), |
| 1234 | 1193 | ], |
| @@ -1233,13 +1192,12 @@ | ||
| 1233 | 1192 | 'help' => esc_html__( 'Switch on to customize shipping form fields.', 'shopbuilder' ), |
| 1234 | 1193 | ], |
| 1235 | 1194 | 'fields' => [ |
| 1236 | 1195 | 'checkout_shipping_info' => [ |
| 1237 | - 'id' => 'checkout_shipping_info', | |
| 1238 | - 'type' => 'deprecated', | |
| 1239 | - 'label' => __( '<strong>Deprecated:</strong> Shipping Form Settings is deprecated. Please use the <strong><u>Checkout Fields Editor</u></strong> module to customize checkout fields. These settings will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is active.', 'shopbuilder' ), | |
| 1240 | - 'customClass' => 'checkout-notice', | |
| 1241 | - 'before_active' => true, | |
| 1196 | + 'id' => 'checkout_shipping_info', | |
| 1197 | + 'type' => 'title', | |
| 1198 | + 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ), | |
| 1199 | + 'customClass' => 'checkout-notice', | |
| 1242 | 1200 | ], |
| 1243 | 1201 | 'shipping_first_name_heading' => [ |
| 1244 | 1202 | 'id' => 'shipping_first_name_heading', |
| 1245 | 1203 | 'type' => 'title', |
| @@ -1673,10 +1631,16 @@ | ||
| 1673 | 1631 | * @param string $tool Meta values. |
| 1674 | 1632 | * @return array |
| 1675 | 1633 | */ |
| 1676 | 1634 | public function get_data_training_note_field( $tool ): array { |
| 1677 | - $progress = get_option( 'rtsb_embedding_progress', [ 'processed' => 0 ] ); | |
| 1678 | - $total = AIFns::need_product_embedding(); | |
| 1635 | + $progress = get_option( | |
| 1636 | + 'rtsb_embedding_progress', | |
| 1637 | + [ | |
| 1638 | + 'processed' => 0, | |
| 1639 | + 'total' => 0, | |
| 1640 | + ] | |
| 1641 | + ); | |
| 1642 | + $total = (int) $progress['total']; | |
| 1679 | 1643 | $processed = (int) $progress['processed']; |
| 1680 | 1644 | $remaining = max( $total - $processed, 0 ); |
| 1681 | 1645 | $generate_url = add_query_arg( |
| 1682 | 1646 | [ |