PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.1
ShopBuilder – WooCommerce Builder For Elementor v3.2.1
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Models/GeneralList.php +55 -198 3.4.13.2.1 View file →
@@ -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' => [
@@ -265,30 +252,9 @@
265 252 ],
266 253 ],
267 254 ],
268 255 ],
269 - /**
270 - * User Will Not Understand how Its Works.
271 - 'gemini_models' => [
272 - 'id' => 'gemini_models',
273 - 'label' => esc_html__( 'Gemini Model', 'shopbuilder' ),
274 - 'type' => 'select',
275 - 'value' => 'gemini-2.5-flash',
276 - 'options' => [
277 - 'gemini-2.5-flash' => esc_html__( 'Gemini 2.5 Flash', 'shopbuilder' ),
278 - 'gemini-2.5-pro' => esc_html__( 'Gemini 2.5 Pro', 'shopbuilder' ),
279 - ],
280 - 'dependency' => [
281 - 'rules' => [
282 - [
283 - 'item' => 'general.ai_implementation.ai_tools',
284 - 'value' => 'Gemini',
285 - 'operator' => '==',
286 - ],
287 - ],
288 - ],
289 - ],
290 - */
256 +
291 257 'gemini_max_token' => [
292 258 'id' => 'gemini_max_token',
293 259 'label' => esc_html__( 'Gemini Maximum Characters', 'shopbuilder' ),
294 260 'type' => 'number',
@@ -392,14 +358,17 @@
392 358 ],
393 359 'minimum_matching_percentage' => [
394 360 'id' => 'minimum_matching_percentage',
395 361 '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 362 'type' => 'number',
398 363 'min' => 1,
399 364 'max' => 99,
400 - 'value' => 40,
401 - 'placeholder' => esc_html__( '40', 'shopbuilder' ),
365 + 'help' => esc_html__(
366 + 'Set the minimum Accuracy.',
367 + 'shopbuilder'
368 + ),
369 + 'value' => 99,
370 + 'placeholder' => esc_html__( '99', 'shopbuilder' ),
402 371 'dependency' => [
403 372 'rules' => [
404 373 [
405 374 'item' => 'general.ai_implementation.ai_tools',
@@ -427,12 +396,9 @@
427 396 ],
428 397 ],
429 398 ],
430 399 ],
431 - 'data_training_note_gemini' => $this->get_data_training_note_field( 'Gemini' ),
432 - 'data_training_note_openai' => $this->get_data_training_note_field( 'OpenAI' ),
433 - 'data_training_note_missing_openai_key' => $this->get_data_training_note_field( 'missingOpenAIKey' ),
434 - 'data_training_note_missing_gemneni_key' => $this->get_data_training_note_field( 'missingGeminiKey' ),
400 + 'data_training_note' => $this->get_data_training_note_field(),
435 401 ],
436 402 ],
437 403 ),
438 404 'notification' => apply_filters(
@@ -438,16 +404,11 @@
438 404 'notification' => apply_filters(
439 405 'rtsb/settings/notification/options',
440 406 [
441 407 'id' => 'notification',
442 - 'icon' => SvgIcons::get( 'notification' ),
443 408 'category' => 'general',
444 409 'title' => esc_html__( 'Notification Settings', 'shopbuilder' ),
445 410 'package' => 'free',
446 - 'links' => [
447 - 'doc' => '',
448 - 'video' => '',
449 - ],
450 411 'active_field' => [
451 412 'disable' => true,
452 413 ],
453 414 'fields' => [
@@ -470,21 +431,8 @@
470 431 'top-center' => esc_html__( 'Top center', 'shopbuilder' ),
471 432 'bottom-center' => esc_html__( 'Bottom center', 'shopbuilder' ),
472 433 ],
473 434 ],
474 - 'notification_timeOut' => [
475 - 'id' => 'notification_timeOut',
476 - 'label' => esc_html__( 'Notification Time-Out (in seconds)', 'shopbuilder' ),
477 - 'type' => 'number',
478 - 'help' => esc_html__(
479 - 'Duration (in seconds) before the notification hides automatically.',
480 - 'shopbuilder'
481 - ),
482 - 'min' => 1,
483 - 'max' => 20,
484 - 'value' => 5,
485 - 'placeholder' => esc_html__( '3', 'shopbuilder' ),
486 - ],
487 435 'notification_color' => [
488 436 'id' => 'notification_color',
489 437 'label' => esc_html__( 'Text Color', 'shopbuilder' ),
490 438 'type' => 'color',
@@ -514,16 +462,11 @@
514 462 'social_share' => apply_filters(
515 463 'rtsb/settings/social_share/options',
516 464 [
517 465 'id' => 'social_share',
518 - 'icon' => SvgIcons::get( 'social_share' ),
519 466 'category' => 'general',
520 467 'title' => esc_html__( 'Social Share Settings', 'shopbuilder' ),
521 468 'package' => 'free',
522 - 'links' => [
523 - 'doc' => '',
524 - 'video' => '',
525 - ],
526 469 'active_field' => [
527 470 'disable' => true,
528 471 ],
529 472 'fields' => [
@@ -570,16 +513,11 @@
570 513 'guest_user' => apply_filters(
571 514 'rtsb/settings/guest_user/options',
572 515 [
573 516 'id' => 'guest_user',
574 - 'icon' => SvgIcons::get( 'guest_user' ),
575 517 'category' => 'general',
576 518 'title' => esc_html__( 'Guest User Controls', 'shopbuilder' ),
577 519 'package' => $this->pro_package(),
578 - 'links' => [
579 - 'doc' => '',
580 - 'video' => '',
581 - ],
582 520 'active_field' => [
583 521 'disable' => true,
584 522 ],
585 523 ],
@@ -587,16 +525,11 @@
587 525 'tooltip' => apply_filters(
588 526 'rtsb/settings/tooltip/options',
589 527 [
590 528 'id' => 'tooltip',
591 - 'icon' => SvgIcons::get( 'tooltip' ),
592 529 'category' => 'general',
593 530 'title' => esc_html__( 'Tooltip Settings', 'shopbuilder' ),
594 531 'package' => $this->pro_package(),
595 - 'links' => [
596 - 'doc' => '',
597 - 'video' => '',
598 - ],
599 532 'active_field' => [
600 533 'disable' => true,
601 534 ],
602 535 ],
@@ -604,16 +537,11 @@
604 537 'billing_form' => apply_filters(
605 538 'rtsb/settings/billing_form/options',
606 539 [
607 540 'id' => 'billing_form',
608 - 'icon' => SvgIcons::get( 'billing_form' ),
609 541 'category' => 'checkout',
610 542 'title' => esc_html__( 'Billing Form Settings', 'shopbuilder' ),
611 543 'package' => 'free',
612 - 'links' => [
613 - 'doc' => '',
614 - 'video' => '',
615 - ],
616 544 'active_field' => [
617 545 'label' => esc_html__( 'Customize Billing Form Fields?', 'shopbuilder' ),
618 546 'help' => esc_html__( 'Switch on to customize billing form fields.', 'shopbuilder' ),
619 547 ],
@@ -618,13 +546,12 @@
618 546 'help' => esc_html__( 'Switch on to customize billing form fields.', 'shopbuilder' ),
619 547 ],
620 548 'fields' => [
621 549 '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,
550 + 'id' => 'checkout_billing_info',
551 + 'type' => 'title',
552 + 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ),
553 + 'customClass' => 'checkout-notice',
627 554 ],
628 555 'billing_first_name_heading' => [
629 556 'id' => 'billing_first_name_heading',
630 557 'type' => 'title',
@@ -1219,16 +1146,11 @@
1219 1146 'shipping_form' => apply_filters(
1220 1147 'rtsb/module/shipping_form/options',
1221 1148 [
1222 1149 'id' => 'shipping_form',
1223 - 'icon' => SvgIcons::get( 'shipping_form' ),
1224 1150 'category' => 'checkout',
1225 1151 'title' => esc_html__( 'Shipping Form Settings', 'shopbuilder' ),
1226 1152 'package' => 'free',
1227 - 'links' => [
1228 - 'doc' => '',
1229 - 'video' => '',
1230 - ],
1231 1153 'active_field' => [
1232 1154 'label' => esc_html__( 'Customize Shipping form Fields?', 'shopbuilder' ),
1233 1155 'help' => esc_html__( 'Switch on to customize shipping form fields.', 'shopbuilder' ),
1234 1156 ],
@@ -1233,13 +1155,12 @@
1233 1155 'help' => esc_html__( 'Switch on to customize shipping form fields.', 'shopbuilder' ),
1234 1156 ],
1235 1157 'fields' => [
1236 1158 '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,
1159 + 'id' => 'checkout_shipping_info',
1160 + 'type' => 'title',
1161 + 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ),
1162 + 'customClass' => 'checkout-notice',
1242 1163 ],
1243 1164 'shipping_first_name_heading' => [
1244 1165 'id' => 'shipping_first_name_heading',
1245 1166 'type' => 'title',
@@ -1666,119 +1587,55 @@
1666 1587 }
1667 1588 return apply_filters( 'rtsb/core/general_settings/raw_list', $list );
1668 1589 }
1669 1590
1591 +
1670 1592 /**
1671 1593 * Get the Data Training Note field.
1672 1594 *
1673 - * @param string $tool Meta values.
1674 1595 * @return array
1675 1596 */
1676 - public function get_data_training_note_field( $tool ): array {
1677 - $progress = get_option( 'rtsb_embedding_progress', [ 'processed' => 0 ] );
1678 - $total = AIFns::need_product_embedding();
1679 - $processed = (int) $progress['processed'];
1680 - $remaining = max( $total - $processed, 0 );
1681 - $generate_url = add_query_arg(
1597 + public function get_data_training_note_field(): array {
1598 + $progress = get_option(
1599 + 'rtsb_embedding_progress',
1682 1600 [
1683 - rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
1684 - 'action' => 'rtsb_start_embedding_process',
1685 - ],
1686 - admin_url( 'admin.php?page=rtsb-settings' )
1601 + 'processed' => 0,
1602 + 'total' => 0,
1603 + ]
1687 1604 );
1688 -
1689 - if ( wp_next_scheduled( 'rtsb_embedding_cron_run' ) ) {
1690 - $text = esc_html__( 'Processing embeddings in the background. You can continue using the site.', 'shopbuilder' );
1605 + $total = (int) $progress['total'];
1606 + $processed = (int) $progress['processed'];
1607 + $remaining = max( $total - $processed, 0 );
1608 + // Build the correct text based on embedding progress.
1609 + if ( $remaining > 0 ) {
1610 + $generate_url = add_query_arg(
1611 + [
1612 + rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
1613 + 'action' => 'rtsb_start_embedding_process',
1614 + ],
1615 + admin_url( 'admin.php?page=rtsb-settings' )
1616 + );
1617 + $text = sprintf(
1618 + '%1$s <a class="rtsb-generate-embedding" href="%2$s">%3$s</a>',
1619 + esc_html__( 'Compatible your existing products with semantic search process.', 'shopbuilder' ),
1620 + esc_url( $generate_url ),
1621 + esc_html__( 'Generate Embeddings', 'shopbuilder' )
1622 + );
1691 1623 } else {
1692 - if ( $remaining > 0 ) {
1693 - // Build the correct text based on embedding progress.
1694 - $text = sprintf(
1695 - '%1$s <a class="rtsb-generate-embedding" href="%2$s">%3$s</a>',
1696 - esc_html__( 'Make Compatible your existing products with semantic search process.', 'shopbuilder' ),
1697 - esc_url( $generate_url ),
1698 - esc_html__( 'Generate Embeddings', 'shopbuilder' )
1699 - );
1700 - } else {
1701 - $text = esc_html__( '🎉 Congratulations! All your products are successfully embedded and up to date.', 'shopbuilder' );
1702 - }
1624 + $text = esc_html__( '🎉 Congratulations! All your products are successfully embedded and up to date.', 'shopbuilder' );
1703 1625 }
1704 - $note = [
1705 - 'OpenAI' => [
1706 - 'id' => 'data_training_note_openai',
1707 - 'type' => 'description',
1708 - 'text' => $text,
1709 - 'dependency' => [
1710 - 'rules' => [
1711 - [
1712 - 'item' => 'general.ai_implementation.ai_tools',
1713 - 'value' => 'OpenAI',
1714 - 'operator' => '==',
1715 - ],
1716 - [
1717 - 'item' => 'general.ai_implementation.gpt_api_key',
1718 - 'value' => '',
1719 - 'operator' => '!=',
1720 - ],
1626 + return [
1627 + 'id' => 'data_training_note',
1628 + 'type' => 'description',
1629 + 'text' => $text,
1630 + 'dependency' => [
1631 + 'rules' => [
1632 + [
1633 + 'item' => 'general.ai_implementation.ai_tools',
1634 + 'value' => [ 'OpenAI', 'Gemini' ],
1635 + 'operator' => 'in',
1721 1636 ],
1722 1637 ],
1723 1638 ],
1724 - 'Gemini' => [
1725 - 'id' => 'data_training_note_gemini',
1726 - 'type' => 'description',
1727 - 'text' => $text,
1728 - 'dependency' => [
1729 - 'rules' => [
1730 - [
1731 - 'item' => 'general.ai_implementation.ai_tools',
1732 - 'value' => 'Gemini',
1733 - 'operator' => '==',
1734 - ],
1735 - [
1736 - 'item' => 'general.ai_implementation.gemini_api_key',
1737 - 'value' => '',
1738 - 'operator' => '!=',
1739 - ],
1740 - ],
1741 - ],
1742 - ],
1743 - 'missingGeminiKey' => [
1744 - 'id' => 'data_training_note_missing_gemneni_key',
1745 - 'type' => 'description',
1746 - 'text' => esc_html__( 'Missing Gemini API key. Enter and save your API key to turn on the data training feature.', 'shopbuilder' ),
1747 - 'dependency' => [
1748 - 'rules' => [
1749 - [
1750 - 'item' => 'general.ai_implementation.ai_tools',
1751 - 'value' => 'Gemini',
1752 - 'operator' => '==',
1753 - ],
1754 - [
1755 - 'item' => 'general.ai_implementation.gemini_api_key',
1756 - 'value' => '',
1757 - 'operator' => '==',
1758 - ],
1759 - ],
1760 - ],
1761 - ],
1762 - 'missingOpenAIKey' => [
1763 - 'id' => 'data_training_note_missing_openai_key',
1764 - 'type' => 'description',
1765 - 'text' => esc_html__( 'Missing OpenAI API key. Enter and save your API key to turn on the data training feature.', 'shopbuilder' ),
1766 - 'dependency' => [
1767 - 'rules' => [
1768 - [
1769 - 'item' => 'general.ai_implementation.ai_tools',
1770 - 'value' => 'OpenAI',
1771 - 'operator' => '==',
1772 - ],
1773 - [
1774 - 'item' => 'general.ai_implementation.gpt_api_key',
1775 - 'value' => '',
1776 - 'operator' => '==',
1777 - ],
1778 - ],
1779 - ],
1780 - ],
1781 1639 ];
1782 - return $note[ $tool ] ?? [];
1783 1640 }
1784 1641 }