diff --git a/assets/ppom-basic-meta.json b/assets/ppom-basic-meta.json index 176f6dc2..bef379e9 100644 --- a/assets/ppom-basic-meta.json +++ b/assets/ppom-basic-meta.json @@ -1 +1 @@ -[{"productmeta_style":"","productmeta_categories":"","send_file_attachment":"","show_cart_thumb":"","aviary_api_key":"","productmeta_validation":"","productmeta_id":"183","productmeta_created":"2019-03-12 14:22:27","productmeta_name":"Basic Fields","dynamic_price_display":"all_option","the_meta":"{"1":{"type":"text","title":"Any text input","data_name":"any_text_input","placeholder":"","description":"It\\\\\\\\'s a test field","error_message":"","maxlength":"","minlength":"","default_value":"","class":"","input_mask":"","width":"12","visibility":"everyone","visibility_role":"","conditions":{"visibility":"Show","bound":"All","rules":[{"elements":"any_text_input","operators":"is","element_values":""}]}},"2":{"type":"select","title":"Test Options","data_name":"test_options","description":"","error_message":"","options":[{"option":"Option A","price":"5","weight":"","id":"option_a"},{"option":"Option B","price":"6","weight":"","id":"option_b"},{"option":"Option C","price":"7","weight":"","id":"option_c"}],"selected":"","first_option":"","class":"","width":"12","visibility":"everyone","visibility_role":"","conditions":{"visibility":"Show","bound":"All","rules":[{"elements":"any_text_input","operators":"is","element_values":""}]}},"3":{"type":"checkbox","title":"Conditional Field","data_name":"conditional_field","description":"Shown when Option B is selected","error_message":"","options":[{"option":"Test Checkbox","price":"","weight":"","id":"test_checkbox"}],"class":"","width":"12","checked":"","min_checked":"","max_checked":"","visibility":"everyone","visibility_role":"","logic":"on","conditions":{"visibility":"Show","bound":"All","rules":[{"elements":"test_options","operators":"is","element_values":"Option B"}]}}}"}] \ No newline at end of file +[{"productmeta_style":"","productmeta_categories":"","send_file_attachment":"","show_cart_thumb":"","aviary_api_key":"","productmeta_validation":"","productmeta_id":"183","productmeta_created":"2019-03-12 14:22:27","productmeta_name":"Basic Fields","dynamic_price_display":"all_option","the_meta":"{"1":{"type":"text","title":"Any text input","data_name":"any_text_input","placeholder":"","description":"It\\\\\\\\'s a test field","error_message":"","maxlength":"","minlength":"","default_value":"","class":"","input_mask":"","width":"12","visibility":"everyone","visibility_role":"","conditions":{"visibility":"Show","bound":"All","rules":[{"elements":"any_text_input","operators":"is","element_values":""}]},"ppom_id":"1"},"2":{"type":"select","title":"Test Options","data_name":"test_options","description":"","error_message":"","options":[{"option":"Option A","price":"5","weight":"","id":"option_a"},{"option":"Option B","price":"6","weight":"","id":"option_b"},{"option":"Option C","price":"7","weight":"","id":"option_c"}],"selected":"","first_option":"","class":"","width":"12","visibility":"everyone","visibility_role":"","conditions":{"visibility":"Show","bound":"All","rules":[{"elements":"any_text_input","operators":"is","element_values":""}]},"ppom_id":"1"},"3":{"type":"checkbox","title":"Conditional Field","data_name":"conditional_field","description":"Shown when Option B is selected","error_message":"","options":[{"option":"Test Checkbox","price":"","weight":"","id":"test_checkbox"}],"class":"","width":"12","checked":"","min_checked":"","max_checked":"","visibility":"everyone","visibility_role":"","logic":"on","conditions":{"visibility":"Show","bound":"All","rules":[{"elements":"test_options","operators":"is","element_values":"Option B"}]},"ppom_id":"1"}}"}] \ No newline at end of file diff --git a/backend/assets/settings.css b/backend/assets/settings.css index 8e5e23cc..6aa34d7c 100644 --- a/backend/assets/settings.css +++ b/backend/assets/settings.css @@ -1,6 +1,6 @@ /*--------------------------------- * Admin Settings Panel CSS - + * It included following css -> Inputs CSS -> Tooltip CSS @@ -45,11 +45,6 @@ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } -.nmsf-wrapper input[type="submit"] { - background: #f95700 !important; - border-color: #f95700 !important; - border-radius: 0 !important; -} .nmsf-migrate-back-btn { border-radius: 0 !important; @@ -289,15 +284,6 @@ /*Admin Settings Panel*/ -.nmsf-wrapper { - position: relative; - border: 1px solid #f957002b; - margin-right: 15px; - margin-top: 22px; - background-color: #eaeaea; - padding: 10px; - box-shadow: 0 1px 3px rgb(0 0 0 / 12%), 0 1px 2px rgb(0 0 0 / 24%); -} .nmsf-wrapper .nmsf-tabs-content div { padding: 15px 20px 15px 40px; @@ -355,6 +341,7 @@ div.nmsf-panels-area { margin: 0; padding: 0; transition: 0.5s all cubic-bezier(0.075, 0.82, 0.165, 1); + margin-left: 30px; } div.nmsf-panels-area .nmsf-panels-content { @@ -410,10 +397,10 @@ div.nmsf-panels-area .nmsf-panels-content p { padding: 8px 10px; margin-right: 2px; cursor: pointer; - background: #3985b7; font-weight: bold; transition: background ease 0.2s; - color: #fff; + border: 1px solid #c3c4c7; + background: #dcdcde; } .nmsf-panels-content-inner .nmsf-panel-settings-area { @@ -421,8 +408,6 @@ div.nmsf-panels-area .nmsf-panels-content p { flex-grow: 1; width: 100%; display: none; - padding: 1rem; - background: #fff; } .nmsf-panels-content-inner input[type=radio] { @@ -430,9 +415,10 @@ div.nmsf-panels-area .nmsf-panels-content p { } .nmsf-panels-content-inner input[type=radio]:checked+label { - background: #fff; - border-top: 2px solid #f95700; - color: #030303; + + border-bottom: 1px solid #f0f0f1; + background: #f0f0f1; + color: #000; } .nmsf-panels-content-inner input[type=radio]:checked+label+.nmsf-panel-settings-area { @@ -453,15 +439,10 @@ div.nmsf-panels-area .nmsf-panels-content p { background-color: transparent; } -.nmsf-panel-table tr { - border-top: 1px solid #f9570094; - border-bottom: 1px solid #f9570094; -} - .nmsf-panel-table td, .nmsf-panel-table th { - padding: .75rem; - vertical-align: top; + vertical-align: middle; + padding-left: 0px; } .nmsf-panel-table th { @@ -605,13 +586,9 @@ div.nmsf-panels-area .nmsf-panels-content p { } .nmsf-section-type h3 { - background-color: #F6F6F6; - margin: 0; - font-weight: 600; - font-family: 'Titillium Web', sans-serif; - font-size: 18px; - padding: 10px; - color: #0473AA; + color: #1d2327; + font-size: 1.3em; + margin: 1em 0; } .nmsf-hint-area { @@ -653,3 +630,25 @@ div.nmsf-panels-area .nmsf-panels-content p { color: #fff; background-color: #343a40; } +.ppom-is-locked-section{ + opacity: 0.7; +} +.ppom-is-locked-field .ppom-notice-upsell{ + font-style: italic; + font-weight: 500; +} +.ppom-is-locked-panel .ppom-notice-upsell { + background: #fff; + border: 1px solid #c3c4c7; + border-left-width: 4px; + box-shadow: 0 1px 1px rgba(0, 0, 0, .04); + border-left-color: #72aee6; + padding: 12px; + margin-top: 15px; +} +.ppom-is-locked-panel .nmsf-panel-desc, .ppom-is-locked-panel .nmsf-panel-table, .ppom-is-locked-field > * > *:not(.ppom-notice-upsell){ opacity: 0.6; cursor: not-allowed; } +.ppom-is-locked-panel input, +.ppom-is-locked-field input, +.ppom-is-locked-field select, +.ppom-is-locked-panel select{ cursor: not-allowed; + pointer-events: none; } \ No newline at end of file diff --git a/backend/changelog_handler.php b/backend/changelog_handler.php index 05c0bcba..da822b70 100644 --- a/backend/changelog_handler.php +++ b/backend/changelog_handler.php @@ -52,7 +52,7 @@ private function parse_changelog( $changelog_path ) { if ( strpos( $changelog_line, '**Changes:**' ) !== false || empty( $changelog_line ) ) { continue; } - if ( substr( ltrim( $changelog_line ), 0, 3 ) === '###' ) { + if ( substr( ltrim( $changelog_line ), 0, 4 ) === '####' ) { $release_count ++; preg_match( '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $changelog_line, $found_v ); @@ -63,7 +63,10 @@ private function parse_changelog( $changelog_path ) { ); continue; } - if ( preg_match( '/[*|-]?\s?(\[fix]|\[Fix]|fix|Fix)[:]?\s?(\b|(?=\[))/', $changelog_line ) ) { + if ( substr( ltrim( $changelog_line ), 0, 3 ) === '###' ) { + continue; + } + if ( preg_match( '/[*|-]?\s?(\[fix]|\[Fix]|fix|Fix|Fixed)[:]?\s?(\b|(?=\[))/', $changelog_line ) ) { $changelog_line = preg_replace( '/[*|-]?\s?(\[fix]|\[Fix]|fix|Fix)[:]?\s?(\b|(?=\[))/', '', $changelog_line ); $releases[ $release_count ]['fixes'][] = $this->parse_md_and_clean( $changelog_line ); continue; diff --git a/backend/options.php b/backend/options.php index ed913003..f9878f92 100644 --- a/backend/options.php +++ b/backend/options.php @@ -27,13 +27,13 @@ 'ppom_disable_bootstrap' => array( 'type' => 'checkbox', 'title' => __( 'Disable Bootstrap', 'woocommerce-product-addon' ), - 'desc' => __( 'Bootstrap JS is being loaded from CDN, it will disable if your site already loading it.', 'woocommerce-product-addon' ), + 'desc' => __( 'Bootstrap JS is loaded from a CDN by default. You can disable it if your site is already loading it.', 'woocommerce-product-addon' ), 'label' => __( 'Yes', 'woocommerce-product-addon' ), ), 'ppom_enable_legacy_inputs_rendering' => array( 'type' => 'checkbox', 'title' => __( 'Legacy Inputs Rendering', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Version 22.0 is major update, if some issues occur you can revert back to old version by this.', 'woocommerce-product-addon' ), + 'desc' => __( 'PPOM Version 22.0 is a major update. If any issues occur, you can revert to the previous version using this option.', 'woocommerce-product-addon' ), ), 'ppom_new_conditions' => array( 'type' => 'checkbox', @@ -43,17 +43,12 @@ 'ppom_legacy_price' => array( 'type' => 'checkbox', 'title' => __( 'Enable Legacy Price Calculations', 'woocommerce-product-addon' ), -// 'reference' => array( -// 'ref_title' => __( 'See reference', 'woocommerce-product-addon' ), -// 'ref_link' => 'https://najeebmedia.com/blog/ppom-version-18-0-better-price-manipulation-currency-switcher/', - // 'ref_video_title' => __( 'Quick Video', 'woocommerce-product-addon' ), - // 'ref_video_link' => 'https://www.youtube.com/watch?v=0wCC3aLXdOw', -// ), + 'desc' => __( 'Enable this option to use the legacy method for price calculations.', 'woocommerce-product-addon' ), ), 'ppom_permission_mfields' => array( 'type' => 'select', 'title' => __( 'PPOM Permissions', 'woocommerce-product-addon' ), - 'desc' => __( 'You can set permissions here so PPOM fields can be managed by different roles', 'woocommerce-product-addon' ), + 'desc' => __( 'You can set permissions here to allow different roles to manage PPOM fields.', 'woocommerce-product-addon' ), 'default' => 'administrator', 'placeholder' => __( 'choose role', 'woocommerce-product-addon' ), 'options' => ppom_get_all_editable_roles(), @@ -61,7 +56,8 @@ ), 'ppom_restricted_file_type' => array( 'type' => 'text', - 'title' => __( 'Restricted file types here', 'woocommerce-product-addon' ), + 'title' => __( 'Restricted File Types', 'woocommerce-product-addon' ), + 'desc' => __( 'Specify the file types that are restricted from being uploaded in this section.', 'woocommerce-product-addon' ), 'default' => __( 'php,php4,php5,php6,php7,phtml,exe,shtml', 'woocommerce-product-addon' ), ), 'ppom_general_section2' => array( @@ -70,7 +66,7 @@ ), 'ppom_label_option_total' => array( 'type' => 'text', - 'title' => __( 'Option Total Label inside Price Table', 'woocommerce-product-addon' ), + 'title' => __( 'Option Total Label Inside Price Table', 'woocommerce-product-addon' ), 'default' => __( 'Option Total', 'woocommerce-product-addon' ), ), 'ppom_label_product_price' => array( @@ -85,13 +81,13 @@ ), 'ppom_label_total_discount' => array( 'type' => 'text', - 'title' => __( 'Total Discount Label inside Price Table', 'woocommerce-product-addon' ), + 'title' => __( 'Total Discount Label Inside Price Table', 'woocommerce-product-addon' ), 'default' => __( 'Total Discount', 'woocommerce-product-addon' ), ), 'ppom_label_option_total_suffex' => array( 'type' => 'text', 'title' => __( 'Option Total Suffix', 'woocommerce-product-addon' ), - 'desc' => __( 'E.g for Tax/Va info like. Vat included', 'woocommerce-product-addon' ), + 'desc' => __( 'Specify the label to display tax or VAT information, such as \'VAT Included\' or \'Tax Applied,\' inside the price table.', 'woocommerce-product-addon' ), ), ); @@ -131,3 +127,624 @@ */ PPOMSETTINGS()->register_tabs( $register_tabs )->register_panel( 'ppom_general_tab', $panel_meta ); PPOMSETTINGS()->register_setting( 'ppom_admin_core_settings', $core_settings ); +function ppom_load_pro_options() { + $pro_settings = array( + 'ppom_pro_basics' => array( + 'type' => 'section', + 'title' => __( 'Basic Settings', 'woocommerce-product-addon' ), + ), + 'ppom_hide_image_cart' => array( + 'type' => 'checkbox', + 'title' => __( 'Hide Images in Cart', 'woocommerce-product-addon' ), + 'desc' => __( 'When using image-type input, the selected images will not be displayed in the cart.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_disable_crop_thumbnail' => array( + 'type' => 'checkbox', + 'title' => __( 'Uploaded Image Resize Proportionally', 'woocommerce-product-addon' ), + 'desc' => __( 'By default, images are resized into a square. Enable this option to resize uploaded images proportionally.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_hide_clear_fields' => array( + 'type' => 'checkbox', + 'title' => __( 'Clear Fields After Add to Cart', 'woocommerce-product-addon' ), + 'desc' => __( 'Clear all fields on the product page after adding the item to the cart.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_enable_client_validation' => array( + 'type' => 'checkbox', + 'title' => __( 'Enable Client-Side Validation', 'woocommerce-product-addon' ), + 'desc' => __( 'Enable this option for faster and more efficient validation of fields directly on the client side.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_disable_meta_paypal_invoice' => array( + 'type' => 'checkbox', + 'title' => __( 'Do Not Send Product Meta to PayPal Invoice', 'woocommerce-product-addon' ), + 'desc' => __( 'Product meta will not be included in the PayPal invoice; only the item name will be sent to the invoice.', 'woocommerce-product-addon' ), + ), + 'ppom_label_select_option' => array( + 'type' => 'text', + 'title' => __( 'Shop Add to Cart Label', 'woocommerce-product-addon' ), + 'desc' => __( 'You can set the \'Add to Cart\' button label here when PPOM is attached.', 'woocommerce-product-addon' ), + 'default' => __( 'Select Options', 'woocommerce-product-addon' ), + ), + 'ppom_pro_pricing' => array( + 'type' => 'section', + 'title' => __( 'Price Settings', 'woocommerce-product-addon' ), + ), + 'ppom_override_product_price' => array( + 'type' => 'checkbox', + 'title' => __( 'Override Product Price', 'woocommerce-product-addon' ), + 'desc' => __( 'Override the core product price on archive and product pages if PPOM field options include a price.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_hide_variable_product_price' => array( + 'type' => 'checkbox', + 'title' => __( 'Hide Variable Product Price', 'woocommerce-product-addon' ), + 'desc' => __( 'Hides the core price of variable products under the price title when PPOM fields are attached.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_hide_option_price' => array( + 'type' => 'checkbox', + 'title' => __( 'Hide Options Price', 'woocommerce-product-addon' ), + 'desc' => __( 'Hides the option prices in Select, Radio, Checkbox, and Image inputs when displaying prices with labels.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_taxable_option_price' => array( + 'type' => 'checkbox', + 'title' => __( 'Taxable Options Price', 'woocommerce-product-addon' ), + 'desc' => __( 'Apply tax settings to option prices as configured in WooCommerce → Tax.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_taxable_fixed_price' => array( + 'type' => 'checkbox', + 'title' => __( 'Apply Tax on Fixed/Cart Fee', 'woocommerce-product-addon' ), + 'desc' => __( 'When this option is enabled, the fixed fee will be taxable.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ), + 'ppom_price_table_location' => array( + 'type' => 'select', + 'title' => __( 'Price Table Position', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the location where the price table will be rendered on the front end.', 'woocommerce-product-addon' ), + 'default' => 'after', + 'options' => array( + 'after' => __( 'After PPOM Fields', 'woocommerce-product-addon' ), + 'before' => __( 'Before PPOM Fields', 'woocommerce-product-addon' ), + ), + ), + 'ppom_pro_advanced' => array( + 'type' => 'section', + 'title' => __( 'Advanced Settings', 'woocommerce-product-addon' ), + ), + 'ppom_remove_unused_images_schedule' => array( + 'type' => 'select', + 'title' => __( 'Delete Unused Images', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the duration for keeping uploaded images from abandoned carts. Reactivate the plugin after updating this option to apply changes.', 'woocommerce-product-addon' ), + 'default' => 'daily', + 'options' => array( + 'daily' => __( 'Daily', 'woocommerce-product-addon' ), + 'weekly' => __( 'Weekly', 'woocommerce-product-addon' ), + 'monthly' => __( 'Monthly', 'woocommerce-product-addon' ), + ), + ), + 'ppom_meta_overrides' => array( + 'type' => 'select', + 'title' => __( 'Meta Group Overrides', 'woocommerce-product-addon' ), + 'desc' => __( 'Leave this set to default if you\'re not sure.', 'woocommerce-product-addon' ), + 'default' => 'default', + 'options' => array( + 'default' => __( 'Default', 'woocommerce-product-addon' ), + 'category_override' => __( 'Category Overrides Individual Assignment', 'woocommerce-product-addon' ), + 'individual_override' => __( 'Individual Overrides Category Assignment', 'woocommerce-product-addon' ), + ), + ), + 'ppom_meta_priority' => array( + 'type' => 'select', + 'title' => __( 'Meta Group Priority', 'woocommerce-product-addon' ), + 'desc' => __( 'Choose which meta group takes priority when applied: Category or Product. Leave this set to default if you\'re not sure.', 'woocommerce-product-addon' ), + 'default' => 'default', + 'options' => array( + 'category_first' => __( 'Category First', 'woocommerce-product-addon' ), + 'individual_first' => __( 'Individual First', 'woocommerce-product-addon' ), + ), + ), + ); + + $style_settings = array( + 'ppom_styles_general_section' => array( + 'type' => 'section', + 'title' => __( 'General Settings', 'woocommerce-product-addon' ), + ), + 'ppom_input_label_style' => array( + 'type' => 'typography', + 'title' => __( 'Field Label', 'woocommerce-product-addon' ), + 'output' => '.ppom-wrapper label.form-control-label', + ), + 'ppom_input_desc_style' => array( + 'type' => 'typography', + 'title' => __( 'Field Description', 'woocommerce-product-addon' ), + 'output' => '.ppom-wrapper .ppom-input-desc', + ), + 'ppom_input_option_label_style' => array( + 'type' => 'typography', + 'title' => __( 'Options Label', 'woocommerce-product-addon' ), + 'output' => '.ppom-wrapper .ppom-input-option-label', + ), + 'ppom_input_option_price_label_style' => array( + 'type' => 'typography', + 'title' => __( 'Options Price Label', 'woocommerce-product-addon' ), + 'output' => '.ppom-wrapper .ppom-option-label-price', + ), + 'ppom_styles_advance_section' => array( + 'type' => 'section', + 'title' => __( 'Input Box Settings', 'woocommerce-product-addon' ), + 'desc' => __( 'PPOM frontend elements can be styled from these settings.', 'woocommerce-product-addon' ), + ), + 'ppom_input_box_bgclr' => array( + 'type' => 'color', + 'title' => __( 'Background Color', 'woocommerce-product-addon' ), + 'output' => array( 'background-color' => '.ppom-wrapper input, .ppom-wrapper select, .ppom-wrapper textarea' ), + ), + 'ppom_input_box_txtclr' => array( + 'type' => 'color', + 'title' => __( 'Text Color', 'woocommerce-product-addon' ), + 'output' => array( 'color' => '.ppom-wrapper input, .ppom-wrapper select, .ppom-wrapper textarea' ), + ), + 'ppom_input_box_border' => array( + 'type' => 'css_editor', + 'title' => __( 'Border Style', 'woocommerce-product-addon' ), + 'mode' => 'border', + 'output' => '.ppom-wrapper input, .ppom-wrapper select, .ppom-wrapper textarea', + ), + 'ppom_input_box_border_focus' => array( + 'type' => 'css_editor', + 'title' => __( 'Border Focus Style', 'woocommerce-product-addon' ), + 'mode' => 'border', + 'output' => '.ppom-wrapper input:focus, .ppom-wrapper select:focus, .ppom-wrapper textarea:focus', + ), + 'ppom_input_box_border_shadow_focus' => array( + 'type' => 'text', + 'title' => __( 'Box Shodow Focus', 'woocommerce-product-addon' ), + 'desc' => __( 'If you don\'t want to apply it, simply set the value to \'none.\'', 'woocommerce-product-addon' ), + 'hint' => '0 0 0 0.2rem rgb(0 123 255 / 25%)', + 'reference' => array( + 'ref_title' => __( 'See reference', 'woocommerce-product-addon' ), + 'ref_link' => 'https://www.w3schools.com/cssref/css3_pr_box-shadow.asp', + ), + ), + 'ppom_styles_price_table_section' => array( + 'type' => 'section', + 'title' => __( 'Price Table Settings', 'woocommerce-product-addon' ), + ), + 'ppom_price_table_txtclr' => array( + 'type' => 'color', + 'title' => __( 'Text Color', 'woocommerce-product-addon' ), + 'output' => array( 'color' => '.ppom-wrapper #ppom-price-container table th, .ppom-wrapper #ppom-price-container table td' ), + ), + 'ppom_price_table_bgclr' => array( + 'type' => 'color', + 'title' => __( 'Background Color', 'woocommerce-product-addon' ), + 'output' => array( 'background-color' => '.ppom-wrapper #ppom-price-container table' ), + ), + 'ppom_styles_tooltip_section' => array( + 'type' => 'section', + 'title' => __( 'Tooltip Settings', 'woocommerce-product-addon' ), + ), + 'ppom_input_tooltip_iconclr' => array( + 'type' => 'color', + 'title' => __( 'Icon Color', 'woocommerce-product-addon' ), + 'output' => array( 'color' => '.ppom-wrapper .ppom-tooltip ' ), + ), + 'ppom_input_tooltip_maxwidth' => array( + 'type' => 'text', + 'title' => __( 'Max. Width', 'woocommerce-product-addon' ), + 'desc' => __( 'Default: 500px', 'woocommerce-product-addon' ), + ), + 'ppom_input_tooltip_txtclr' => array( + 'type' => 'color', + 'title' => __( 'Text Color', 'woocommerce-product-addon' ), + ), + 'ppom_input_tooltip_bgclr' => array( + 'type' => 'color', + 'title' => __( 'Background Color', 'woocommerce-product-addon' ), + ), + 'ppom_input_tooltip_borderclr' => array( + 'type' => 'color', + 'title' => __( 'Border Color', 'woocommerce-product-addon' ), + ), + 'ppom_input_tooltip_position' => array( + 'type' => 'select', + 'title' => __( 'Position', 'woocommerce-product-addon' ), + 'options' => array( + 'top' => __( 'Top', 'woocommerce-product-addon' ), + 'bottom' => __( 'Bottom', 'woocommerce-product-addon' ), + 'left' => __( 'Left', 'woocommerce-product-addon' ), + 'right' => __( 'Right', 'woocommerce-product-addon' ), + ), + ), + 'ppom_input_tooltip_animation' => array( + 'type' => 'select', + 'title' => __( 'Animation', 'woocommerce-product-addon' ), + 'options' => array( + 'fade' => __( 'Fade', 'woocommerce-product-addon' ), + 'grow' => __( 'Grow', 'woocommerce-product-addon' ), + 'swing' => __( 'Swing', 'woocommerce-product-addon' ), + 'slide' => __( 'Slide', 'woocommerce-product-addon' ), + 'fall' => __( 'Fall', 'woocommerce-product-addon' ), + ), + ), + 'ppom_input_tooltip_interactive' => array( + 'type' => 'checkbox', + 'title' => __( 'Interactive', 'woocommerce-product-addon' ), + 'desc' => __( 'Allow users to interact with the tooltip.', 'woocommerce-product-addon' ), + ), + 'ppom_input_tooltip_trigger' => array( + 'type' => 'checkbox', + 'title' => __( 'Open Tooltip on click', 'woocommerce-product-addon' ), + 'desc' => __( 'Allow users to open the tooltip by clicking on it. Default behavior is hover.', 'woocommerce-product-addon' ), + ), + ); + + $panels = array( + 'ppom_admin_pro_settings' => array( + 'id' => 'ppom_admin_pro_settings', + 'title' => __( 'Pro Settings', 'woocommerce-product-addon' ), + 'desc' => '', + 'is_available' => false, + 'is_sabpanel' => true, + ), + 'ppom_admin_fields_settings' => array( + 'id' => 'ppom_admin_fields_settings', + 'title' => __( 'Fields Settings', 'woocommerce-product-addon' ), + 'is_available' => false, + 'desc' => '', + 'is_sabpanel' => true, + ), + 'ppom_admin_style_settings' => array( + 'id' => 'ppom_admin_style_settings', + 'title' => __( 'Style Settings', 'woocommerce-product-addon' ), + 'desc' => '', + 'is_available' => false, + 'is_sabpanel' => true, + ), + ); + PPOMSETTINGS()->register_panel( 'ppom_general_tab', $panels ); + + + PPOMSETTINGS()->register_setting( 'ppom_admin_pro_settings', $pro_settings ); + PPOMSETTINGS()->register_setting( 'ppom_admin_style_settings', $style_settings ); + + $settings = array( + 'ppom_cart_enabled' => array( + 'type' => 'checkbox', + 'title' => __( 'Enable PPOM Cart Edit', 'woocommerce-product-addon' ), + 'desc' => __( 'Enable this option to allow editing of PPOM fields in the cart.', 'woocommerce-product-addon' ), + ), + 'ppom-cart-edit-popup' => array( + 'type' => 'checkbox', + 'title' => __( 'Popup Edit', 'woocommerce-product-addon' ), + 'desc' => __( 'Enable this option to open field editing for PPOM options in a popup.', 'woocommerce-product-addon' ), + ), + 'ppom_editcart_editoptions_text' => array( + 'type' => 'text', + 'title' => __( 'Edit Options Text', 'woocommerce-product-addon' ), + 'default' => __( 'Edit Options', 'woocommerce-product-addon' ), + 'desc' => __( 'Change the label for the edit options button.', 'woocommerce-product-addon' ), + ), + 'ppom_edit_link_class' => array( + 'type' => 'text', + 'title' => __( 'Edit Button Class', 'woocommerce-product-addon' ), + 'desc' => __( 'Add custom CSS classes to the edit button, separated by spaces.', 'woocommerce-product-addon' ), + ), + 'ppom_editcart_popup' => array( + 'type' => 'checkbox', + 'title' => __( 'Fields Modal', 'woocommerce-product-addon' ), + 'desc' => __( 'This will display PPOM fields inside a modal instead of on the cart line item, keeping your cart page simple and clean.', 'woocommerce-product-addon' ), + ), + 'ppom_editcart_popup_label' => array( + 'type' => 'text', + 'title' => __( 'Model Button Label', 'woocommerce-product-addon' ), + 'desc' => __( 'Change the label for the modal button.', 'woocommerce-product-addon' ), + ), + ); + + $panels = array( + 'ppom_addon_cartedit' => array( + 'id' => 'ppom_addon_cartedit', + 'title' => __( 'Cart Edit', 'woocommerce-product-addon' ), + 'desc' => '', + 'icon' => '', + 'is_available' => false, + 'is_sabpanel' => true, + 'active' => 'yes', + ), + ); + + PPOMSETTINGS()->register_panel( 'ppom_general_tab', $panels )->register_setting( 'ppom_addon_cartedit', $settings ); + + $settings = array( + 'ppom-enf-emails-list' => array( + 'type' => 'text', + 'title' => __( 'Emails Recepients', 'woocommerce-product-addon' ), + 'desc' => __( 'Enter the email addresses of the enquiry form recipients, separated by commas.', 'woocommerce-product-addon' ), + ), + 'ppom-enf-note' => array( + 'type' => 'textarea', + 'title' => __( 'Note', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the message to be displayed on the enquiry form.', 'woocommerce-product-addon' ), + 'default' => 'All selected data will be sent to vendor', + ), + 'ppom-enf-send-msg' => array( + 'type' => 'textarea', + 'title' => __( 'Send Message', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the message to be displayed after the enquiry form is submitted.', 'woocommerce-product-addon' ), + ), + 'ppom-enf-btn-title' => array( + 'type' => 'text', + 'title' => __( 'Button Title', 'woocommerce-product-addon' ), + 'desc' => __( 'Change the title of the enquiry form button.', 'woocommerce-product-addon' ), + ), + 'ppom-enf-btn-class' => array( + 'type' => 'text', + 'title' => __( 'Button Class', 'woocommerce-product-addon' ), + 'desc' => __( ' Add custom CSS classes to the enquiry form button, separated by commas.', 'woocommerce-product-addon' ), + ), + 'ppom-enf-btn-text-color' => array( + 'type' => 'color', + 'title' => __( 'Button Text Color', 'woocommerce-product-addon' ), + ), + 'ppom-enf-btn-bg-color' => array( + 'type' => 'color', + 'title' => __( 'Button Background Color', 'woocommerce-product-addon' ), + ), + 'ppom-enf-user-send' => array( + 'type' => 'checkbox', + 'title' => __( 'Send Enquiry Form Data to User', 'woocommerce-product-addon' ), + 'desc' => __( 'Enable this option to send a copy of the enquiry form data to the user.', 'woocommerce-product-addon' ), + ), + 'ppom-enf-hide-cart' => array( + 'type' => 'checkbox', + 'title' => __( 'Hide Add to Cart Button', 'woocommerce-product-addon' ), + 'desc' => __( 'Enable this option to hide the \'Add to Cart\' button on the product page.', 'woocommerce-product-addon' ), + ), + ); + + $panels = array( + 'ppom_addon_enquiryform' => array( + 'id' => 'ppom_addon_enquiryform', + 'title' => __( 'Enquiry Form', 'woocommerce-product-addon' ), + 'desc' => '', + 'icon' => '', + 'is_available' => false, + 'active' => 'yes', + 'is_sabpanel' => true, + ), + ); + + + PPOMSETTINGS()->register_panel( 'ppom_general_tab', $panels )->register_setting( 'ppom_addon_enquiryform', $settings ); + + + $settings = array( + 'ppom_fieldspopup_section' => array( + 'type' => 'section', + 'is_available' => false, + 'title' => __( 'Fields Popup', 'woocommerce-product-addon' ), + ), + 'ppom-fieldspopup-enable' => array( + 'type' => 'checkbox', + 'is_available' => false, + 'title' => __( 'Enable Fields Popup', 'woocommerce-product-addon' ), + 'desc' => __( 'Enable the PPOM fields popup for all products.', 'woocommerce-product-addon' ), + ), + 'ppom-fieldspopup-btn-label' => array( + 'type' => 'text', + 'is_available' => false, + 'title' => __( 'Button Label', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the label for the popup button.', 'woocommerce-product-addon' ), + ), + 'ppom-fieldspopup-btn-textcolor' => array( + 'type' => 'color', + 'is_available' => false, + 'title' => __( 'Button Text Color', 'woocommerce-product-addon' ), + ), + 'ppom-fieldspopup-btn-bgcolor' => array( + 'type' => 'color', + 'is_available' => false, + 'title' => __( 'Button Background Color', 'woocommerce-product-addon' ), + ), + ); + + PPOMSETTINGS()->register_setting( 'ppom_admin_fields_settings', $settings ); + + $settings = array( + 'ppom_collapse_section' => array( + 'type' => 'section', + 'is_available' => false, + 'title' => __( 'Collapse Field', 'woocommerce-product-addon' ), + ), + 'ppom-colapse-multiple-open' => array( + 'type' => 'checkbox', + 'is_available' => false, + 'title' => __( 'Multiple Collapse Open', 'woocommerce-product-addon' ), + 'desc' => __( 'Allow multiple collapsible sections to be open at the same time.', 'woocommerce-product-addon' ), + ), + 'ppom-colapse-hide-arrow' => array( + 'type' => 'checkbox', + 'is_available' => false, + 'title' => __( 'Hide Headline Arrow', 'woocommerce-product-addon' ), + 'desc' => __( 'Hide the arrow displayed under the headline.', 'woocommerce-product-addon' ), + ), + 'ppom-colapse-icon-position' => array( + 'type' => 'select', + 'is_available' => false, + 'title' => __( 'Collapse Icon Position', 'woocommerce-product-addon' ), + 'default' => 'right', + 'options' => array( + 'left' => 'Left', + 'right' => 'Right', + ), + 'desc' => __( 'Control the position of the collapse icon.', 'woocommerce-product-addon' ), + ), + 'ppom-colapse-text-color' => array( + 'type' => 'color', + 'is_available' => false, + 'title' => __( 'Collapse Text Color', 'woocommerce-product-addon' ), + ), + 'ppom-colapse-bg-color' => array( + 'type' => 'color', + 'is_available' => false, + 'title' => __( 'Collapse Background Color', 'woocommerce-product-addon' ), + ), + 'ppom-colapse-open-text-color' => array( + 'type' => 'color', + 'is_available' => false, + 'title' => __( 'Collapse Open Text Color', 'woocommerce-product-addon' ), + ), + 'ppom-colapse-open-bg-color' => array( + 'type' => 'color', + 'is_available' => false, + 'title' => __( 'Collapse Open Background Color', 'woocommerce-product-addon' ), + ), + 'ppom-collapse-nextprev' => array( + 'type' => 'checkbox', + 'is_available' => false, + 'title' => __( 'Allow Next/Prev', 'woocommerce-product-addon' ), + 'desc' => __( 'Allow user to show/hide collapse using prev/next button.', 'woocommerce-product-addon' ), + ), + ); + + PPOMSETTINGS()->register_setting( 'ppom_admin_fields_settings', $settings ); + + + $settings = array( + 'ppom_repeater_section' => array( + 'type' => 'section', + 'is_available' => false, + 'title' => __( 'Field Repeater', 'woocommerce-product-addon' ), + ), + 'ppom_repeater_clone_title' => array( + 'type' => 'text', + 'is_available' => false, + 'title' => __( 'Clone Title', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the title attribute for the Clone icon.', 'woocommerce-product-addon' ), + ), + 'ppom_repeater_remove_title' => array( + 'type' => 'text', + 'is_available' => false, + 'title' => __( 'Remove Title', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the title attribute for the Remove icon.', 'woocommerce-product-addon' ), + ), + 'ppom_repeater_icons_size' => array( + 'type' => 'text', + 'is_available' => false, + 'title' => __( 'Icons Size', 'woocommerce-product-addon' ), + 'desc' => __( 'Icons size e.g 25px. Defaults to 20px.', 'woocommerce-product-addon' ), + ), + 'ppom_repeater_clone_mode' => array( + 'type' => 'select', + 'is_available' => false, + 'options' => [ + 'first_box' => 'Clone from first box only', + 'each_box' => 'Clone from each box', + ], + 'title' => __( 'Clone Mode', 'woocommerce-product-addon' ), + 'desc' => __( 'How to clone the fields', 'woocommerce-product-addon' ), + ), + 'ppom_repeater_clone_position' => array( + 'type' => 'select', + 'is_available' => false, + 'options' => [ + 'top' => 'Top', + 'bottom' => 'Bottom', + ], + 'title' => __( 'Clone Icons Position', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the placement of the clone icons within the repeater fields.', 'woocommerce-product-addon' ), + ), + 'ppom_repeater_icon_lib' => array( + 'type' => 'select', + 'is_available' => false, + 'options' => [ + 'dashicons' => 'Dashicons', + 'fontawesome' => 'FontAwesome', + ], + 'title' => __( 'Icons Library', 'woocommerce-product-addon' ), + 'desc' => __( 'Select the icon library to be used for displaying icons.', 'woocommerce-product-addon' ), + ), + ); + + PPOMSETTINGS()->register_setting( 'ppom_admin_fields_settings', $settings ); + + + $settings = array( + 'ppom_bq_section' => array( + 'type' => 'section', + 'is_available' => false, + 'title' => __( 'Bulk Quantity', 'woocommerce-product-addon' ), + ), + 'ppom-bq-display-type' => array( + 'type' => 'select', + 'is_available' => false, + 'title' => __( 'Display Type', 'woocommerce-product-addon' ), + 'default' => 'Bulk Quantity Standard', + 'options' => array( + 'bq_standard' => __( 'Bulk Quantity Standard', 'woocommerce-product-addon' ), + 'bq_packaged' => __( 'Bulk Quantity Packaged', 'woocommerce-product-addon' ) + ), + 'desc' => __( 'Choose how bulk quantities are displayed. Select \'Bulk Quantity Standard\' for standard bulk orders or \'Bulk Quantity Packaged\' for pre-packaged bulk quantities.', 'woocommerce-product-addon' ), + ) + ); + + PPOMSETTINGS()->register_setting( 'ppom_admin_fields_settings', $settings ); + + $integration_settings = array(); + + $integration_settings['ppom_integrations_rest'] = array( + 'type' => 'section', + 'title' => __( 'REST API', 'woocommerce-product-addon' ), + ); + $integration_settings['ppom_api_enable'] = array( + 'type' => 'checkbox', + 'title' => __( 'PPOM REST API', 'woocommerce-product-addon' ), + 'desc' => __( 'Check this option to enable PPOM REST API.', 'woocommerce-product-addon' ), + ); + $integration_settings['ppom_rest_secret_key'] = array( + 'type' => 'text', + 'title' => __( 'Secret Key', 'woocommerce-product-addon' ), + 'desc' => __( 'Enter any characters to create a secret key. This key must be provided when making API requests.', 'woocommerce-product-addon' ), + ); + + $integration_settings['ppom_integrations_wcfm'] = array( + 'type' => 'section', + 'title' => __( 'WCFM Vendors', 'woocommerce-product-addon' ), + ); + $integration_settings['ppom_wcfm_allow_vendors'] = array( + 'type' => 'checkbox', + 'title' => __( 'Allow Vendors to Create/Edit PPOM Fields', 'woocommerce-product-addon' ), + 'desc' => __( 'Enable this option to allow vendors to create or edit PPOM fields. These fields will be global.', 'woocommerce-product-addon' ), + 'label' => __( 'Yes', 'woocommerce-product-addon' ), + ); + $integration_settings['ppom_label_wcfm'] = array( + 'type' => 'text', + 'title' => __( 'Store Title', 'woocommerce-product-addon' ), + 'desc' => __( 'Set the label to display on the product edit page.', 'woocommerce-product-addon' ), + 'default' => __( 'Custom Fields', 'woocommerce-product-addon' ), + // Uncomment this section if you want to add conditions + // 'conditions' => array( + // array('ppom_wcfm_allow_vendors' , '==', array('true')), + // ) + ); + + + $panels = array( + 'ppom_integrations' => array( + 'id' => 'ppom_integrations', + 'is_available' => false, + 'title' => __( 'Integrations', 'woocommerce-product-addon' ), + 'is_sabpanel' => true, + ) + ); + PPOMSETTINGS()->register_panel( 'ppom_general_tab', $panels )->register_setting( 'ppom_integrations', $integration_settings ); + +} +add_action('init', 'ppom_load_pro_options', 99); \ No newline at end of file diff --git a/backend/settings-panel.class.php b/backend/settings-panel.class.php index 3bce2429..f514977a 100644 --- a/backend/settings-panel.class.php +++ b/backend/settings-panel.class.php @@ -204,6 +204,7 @@ public function register_tabs( $tabs ) { public function register_panel( $tab_id, $panels ) { + $panels = apply_filters( 'ppom_register_panel', $panels ); // only used for store all Panels on single array $this->panels = array_merge( $this->panels, $panels ); @@ -219,6 +220,7 @@ public function register_panel( $tab_id, $panels ) { */ public function register_setting( $panel_id, $settings ) { + $settings = apply_filters( 'ppom_register_settings', $settings ); // only used for store all settings on single array $this->settings_array = array_merge( $this->settings_array, $settings ); @@ -312,7 +314,9 @@ function save_settings() { $response = array(); if ( isset( $_REQUEST[ self::$save_key ] ) ) { - + $_REQUEST[ self::$save_key ] = array_filter( $_REQUEST[ self::$save_key ] , function ( $key ) { + return strpos( $key, '_locked' ) === false; + }, ARRAY_FILTER_USE_KEY ); // $settings_meta = $_REQUEST[self::$save_key]; $settings_meta = array_map( function ( $setting ) { @@ -324,7 +328,6 @@ function ( $setting ) { $_REQUEST[ self::$save_key ] ); - // Generate and saved css $this->generate_css( $settings_meta ); diff --git a/backend/templates/admin-settings.php b/backend/templates/admin-settings.php index 65a5a42e..906b2ac1 100644 --- a/backend/templates/admin-settings.php +++ b/backend/templates/admin-settings.php @@ -46,52 +46,17 @@ - -
+ ', esc_url( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ), '' ); ?> +
+