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 @@ - -
-
-
-

- get_config( 'name' ); ?> - get_config( 'version' ); ?> -

-
-
- - -
-
-
-
-
- $tab ) { - $title = isset( $tab['title'] ) ? $tab['title'] : ''; - $desc = isset( $tab['desc'] ) ? $tab['desc'] : ''; - $icon = isset( $tab['icon'] ) ? $tab['icon'] : ''; - $enable = isset( $tab['enable'] ) ? $tab['enable'] : ''; - $classes = isset( $tab['classes'] ) ? $tab['classes'] : array(); - - if ( $enable ) { - ?> -
- - -
- - -
-
-
+
- +

+ + +

$tab_meta ) { $panel_meta = isset( $tab_meta['panels'] ) ? $tab_meta['panels'] : array(); @@ -109,6 +74,7 @@ class="button button-primary button-large nmsf-migrate-back-btn">" > -
+ class="nmsf-label "> + + + + +
+ +

+ ', esc_url( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ), '' ); ?> +

+
+ $video_title = isset( $reference['ref_video_title'] ) ? $reference['ref_video_title'] : ''; $video_link = isset( $reference['ref_video_link'] ) ? $reference['ref_video_link'] : ''; $input_meta['input_id'] = $id; - $condition_class = ''; + $is_input_available = isset( $input_meta['is_available'] ) ? $input_meta['is_available'] : $is_available; + if ( ! $is_input_available ) { + $condition_class .= 'ppom-is-locked-field'; + $input_meta['input_id'] = '_locked' . $input_meta['input_id']; + } if ( ! empty( $conditions ) ) { - $condition_class = 'nmsf-panel-conditional-field'; + $condition_class .= 'nmsf-panel-conditional-field'; } ?> @@ -162,6 +142,12 @@ class="nmsf-label"> class="" > '; + $is_image_file = ppom_is_file_image( $file_name ); + $ppom_file_thumb_url = $is_image_file ? ppom_get_dir_url( true ) . $file_name : PPOM_URL . '/images/file.png'; + $order_html .= ''; + $order_html .= ''; } + + $order_html .= ''; $order_html .= ''; if ( $input_type == 'cropper' ) { $cropped_file_name = ppom_file_get_name( $file_name, $item->get_product_id() ); $cropped_url = ppom_get_dir_url() . 'cropped/' . $cropped_file_name; - $order_html .= ''; // Requested by Kevin, hiding downloading file button after order on thank you page // @since version 16.6 if ( is_admin() ) { - $order_html .= ''; } @@ -1614,7 +1629,7 @@ function ppom_generate_html_for_files( $file_names, $input_type, $item ) { $edit_file_name = ppom_file_get_name( $file_name, $item->get_product_id() ); $edit_url = ppom_get_dir_url() . 'edits/' . $edit_file_name; $edit_thumb_url = ppom_get_dir_url() . 'edits/thumbs/' . $file_name; - $order_html .= ''; $order_html .= ''; $ppom_html .= ''; diff --git a/inc/hooks.php b/inc/hooks.php index f26474c8..1abe0f2a 100644 --- a/inc/hooks.php +++ b/inc/hooks.php @@ -705,7 +705,7 @@ function ppom_hooks_input_main_wrapper_class( $wrapper_class, $classes_array, $f foreach ( $conditions['rules'] as $index => $rule ) { - $element = isset( $rule['elements'] ) ? $rule['elements'] : ''; + $element = isset( $rule['elements'] ) ? strtolower( $rule['elements'] ): ''; $wrapper_class .= " ppom-cond-{$element}"; $wrapper_class .= " ppom-locked-{$element}"; } diff --git a/js/admin/ppom-admin.js b/js/admin/ppom-admin.js index 23f5c1d9..8e9a4222 100644 --- a/js/admin/ppom-admin.js +++ b/js/admin/ppom-admin.js @@ -59,6 +59,7 @@ jQuery(function($) { e.preventDefault(); $("body").append(append_overly_model); var modalBox = $(this).attr('data-modal-id'); + lockedDataName = false; $('#' + modalBox).fadeIn(); }); @@ -117,6 +118,10 @@ jQuery(function($) { **/ $('.ppom-import-export-btn').on('click', function(event) { event.preventDefault(); + if ( $(".ppom-import-export-block").length === 0 ) { + $('#ppom-import-upsell').fadeIn(); + return; + } $('.ppom-more-plugins-block').hide(); $(".ppom-import-export-block").show(); $(".ppom-product-meta-block").hide(); @@ -211,29 +216,27 @@ jQuery(function($) { var check_field = $('.ppom-check-one-field input[type="checkbox"]:checked'); if (check_field.length > 0) { - swal.fire({ - title: "Are you sure", - showCancelButton: true, - confirmButtonColor: "#DD6B55 ", - cancelButtonColor: "#DD6B55", - confirmButtonText: "Yes", - cancelButtonText: "No", - }).then( (result ) => { - if (!result.isConfirmed) return; - - $('.ppom_field_table').find('.ppom-check-one-field input').each(function(i, meta_field) { - - if (this.checked) { - var field_id = $(meta_field).val(); - // console.log(field_id) - $(meta_field).parent().parent().parent('.row_no_' + field_id + '').remove(); - } - $('.ppom_save_fields_model').find('#ppom_field_model_' + field_id + '').remove(); - }); - }); + window?.ppomPopup?.open({ + title: window?.ppom_vars?.i18n.popup.confirmTitle, + onConfirmation: () => { + $('.ppom_field_table').find('.ppom-check-one-field input').each(function(i, meta_field) { + + const field_id = $(meta_field).val(); + if (this.checked) { + // console.log(field_id) + $(meta_field).parent().parent().parent('.row_no_' + field_id + '').remove(); + } + $('.ppom_save_fields_model').find('#ppom_field_model_' + field_id + '').remove(); + }); + } + }) } else { - swal.fire("Please at least check one field!", "", "error"); + window?.ppomPopup?.open({ + title: window.ppom_vars.i18n.popup.checkFieldTitle, + type: "error", + hideCloseBtn: true + }) } }); @@ -262,11 +265,13 @@ jQuery(function($) { /** 9- Edit Existing Fields **/ + var lockedDataName = false; $(document).on('click', '.ppom-edit-field', function(event) { event.preventDefault(); var the_id = $(this).attr('id'); - $('#ppom_field_model_' + the_id + '').find('.ppom-close-checker').removeClass('ppom-close-fields'); + $('#ppom_field_model_' + the_id).find('.ppom-close-checker').removeClass('ppom-close-fields'); + lockedDataName = true; }); @@ -436,7 +441,18 @@ jQuery(function($) { var field_model_id = 'ppom_field_model_' + field_no + ''; - clone_new_field.find('.ppom_save_fields_model').end().appendTo('.ppom_save_fields_model').attr('id', field_model_id); + clone_new_field.find('.ppom_save_fields_model') + .end() + .appendTo('.ppom_save_fields_model') + .attr('id', field_model_id) + .find( '.ppom-tabs-header label.ppom-tabs-label' ) + .each( function( index, item ) { + var tabId = $(item).attr('id'); + var hasTabOptions = $( '#' + field_model_id, document )?.find( '.ppom_handle_' + tabId )?.length > 0; + if ( ! hasTabOptions ) { + $(item).hide(); + } + } ); clone_new_field.find('.ppom-field-checker').attr('data-field-index', field_no); clone_new_field.find('.ppom-field-checker').addClass('ppom-add-fields-js-action'); @@ -990,7 +1006,10 @@ jQuery(function($) { if (wp_field == 'shipping_fields' || wp_field == 'billing_fields') { return; } - selector.find('[data-meta-id="data_name"] input[type="text"]').val(field_id); + if ( true === lockedDataName ) { + return; + } + selector.find('[data-meta-id="data_name"] input[type="text"]:not([readonly])').val(field_id); }); @@ -1356,6 +1375,46 @@ jQuery(function($) { $(clone_new_field).find('input[data-metatype="jquery_dp"]').change(toggleHandler.activateHandler); } ); + // Unsaved form exit confirmation. + var unsaved = false; + $( ':input' ).change(function () { + if ( $( this ).parents( '.ppom-checkboxe-style' )?.length > 0 ) { + unsaved = false; + return; + } + unsaved = true; + }); + $( document ).on( 'click', '.ppom-submit-btn input.btn, button.ppom_copy_field, button.ppom-add-fields-js-action', function() { + if ( $(this).hasClass('ppom_copy_field') || $(this).hasClass( 'ppom-add-fields-js-action' ) ) { + unsaved = true; + return; + } + unsaved = false; + } ); + window.addEventListener( 'beforeunload', function( e ) { + if ( unsaved ) { + e.preventDefault(); + e.returnValue = ''; + } + }); + + $( document ).on( 'ppom_fields_tab_changed', function(e, id, tab) { + if ( 'condition_tab' !== id ) { + return; + } + + if ( ! $('input[data-metatype="logic"]', tab?.first() )?.is(':checked') ) { + tab?.last()?.addClass( 'ppom-disabled-overlay' ); + } + } ); + + $( document ).on( 'change', 'input[data-metatype="logic"]:visible', function() { + $(this) + .parents('.ppom_handle_condition_tab') + .next('.ppom_handle_condition_tab') + .toggleClass('ppom-disabled-overlay'); + } ); + $(document).ready(function(){ $('.ppom-slider').each(function(i, item){ const itemEl = $(item); diff --git a/js/admin/ppom-meta-table.js b/js/admin/ppom-meta-table.js index b75968e8..0590144f 100644 --- a/js/admin/ppom-meta-table.js +++ b/js/admin/ppom-meta-table.js @@ -30,20 +30,12 @@ jQuery(function($){ 2- Delete Selected Products **/ function deleteSelectedProducts(checkedProducts_ids) { - swal.fire({ - title: "Are you sure?", - type: "warning", - showCancelButton: true, - confirmButtonColor: "#DD6B55 ", - cancelButtonColor: "#DD6B55", - confirmButtonText: "Yes", - cancelButtonText: "No", - }).then( (result ) => { - if (!result.isConfirmed) return; - + window?.ppomPopup?.open({ + title: window?.ppom_vars?.i18n.popup.confirmTitle, + onConfirmation: () => { $('#ppom_delete_selected_products_btn').html('Deleting...'); - var data = { + const data = { action : 'ppom_delete_selected_meta', productmeta_ids : checkedProducts_ids, ppom_meta_nonce : $("#ppom_meta_nonce").val() @@ -52,12 +44,22 @@ jQuery(function($){ $.post(ajaxurl, data, function(resp){ $('#ppom_delete_selected_products_btn').html('Delete'); if (resp) { - swal.fire({title: "Done", text: resp, type: "success" ,confirmButtonColor: '#217ac8'}).then(()=>location.reload()); - }else{ - swal.fire(resp, "", "error").then(); + window?.ppomPopup?.open({ + title: window?.ppom_vars?.i18n.popup.finishTitle, + hideCloseBtn: true, + onConfirmation: () => location.reload(), + onClose: () => location.reload() + }); + } else { + window?.ppomPopup?.open({ + title: window.ppom_vars.i18n.popup.errorTitle, + text: resp, + hideCloseBtn: true + }); } }); - }); + } + }) } @@ -122,34 +124,38 @@ jQuery(function($){ **/ $('body').on('click','a.ppom-delete-single-product', function(e){ e.preventDefault(); - var productmeta_id = $(this).attr('data-product-id'); - - swal.fire({ - title: "Are you sure?", - showCancelButton: true, - confirmButtonColor: "#DD6B55 ", - cancelButtonColor: "#DD6B55", - confirmButtonText: "Yes", - cancelButtonText: "No", - }).then( (result ) => { - if (!result.isConfirmed) return; + const productmeta_id = $(this).attr('data-product-id'); + + window?.ppomPopup?.open({ + title: window?.ppom_vars?.i18n.popup.confirmTitle, + onConfirmation: () => { $("#del-file-" + productmeta_id).html(''); - var data = { + const data = { action : 'ppom_delete_meta', productmeta_id : productmeta_id, ppom_meta_nonce : $("#ppom_meta_nonce").val() }; - $.post(ajaxurl, data, function(resp){ + $.post( ajaxurl, data, function(resp){ $("#del-file-" + productmeta_id).html(''); - if (resp.status === 'success') { - swal.fire({title: "Done", text: resp.message, type: "success" ,confirmButtonColor: '#217ac8'}).then(()=>location.reload()); - }else{ - swal.fire(resp.message, "", "error"); + if ( resp.status === 'success' ) { + window?.ppomPopup?.open({ + title: window?.ppom_vars?.i18n.popup.finishTitle, + hideCloseBtn: true, + onConfirmation: () => location.reload(), + onClose: () => location.reload() + }); + } else { + window?.ppomPopup?.open({ + title: window.ppom_vars.i18n.popup.errorTitle, + text: resp.message, + hideCloseBtn: true, + }); } }); - }); + } + }) }); $(document).on( 'change', '#ppom-bulk-actions', function(){ @@ -160,7 +166,11 @@ jQuery(function($){ }).get(); if ( ! ( checkedProducts_ids.length > 0 ) ) { - swal.fire("Please at least check one Meta!", "", "error"); + window?.ppomPopup?.open({ + title: window?.ppom_vars?.i18n.popup.confirmTitle, + type: 'error', + hideCloseBtn: true + }); return; } @@ -175,7 +185,7 @@ jQuery(function($){ const exportOption = ppom_vars.ppomProActivated === 'yes' ? `` : ``; - const importBtn = ppom_vars.ppomProActivated === 'yes' ? `${ppom_vars.i18n.importLabel}` : `${ppom_vars.i18n.importLockedLabel}`; + const importBtn = `${ppom_vars.i18n.importLabel}`; const bulkActions = ` + +
+

selector

+

+
+

@@ -421,10 +425,6 @@ class="dashicons dashicons-edit">
-

-

-
render_field_settings(); ?>
diff --git a/templates/frontend/inputs/image.php b/templates/frontend/inputs/image.php index 44f1213d..bad7223a 100644 --- a/templates/frontend/inputs/image.php +++ b/templates/frontend/inputs/image.php @@ -13,10 +13,11 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -$fm = new PPOM_InputManager( $field_meta, 'image' ); -$legacy_view = $fm->get_meta_value( 'legacy_view' ); -$multiple_allowed = $fm->get_meta_value( 'multiple_allowed' ); -$show_popup = $fm->get_meta_value( 'show_popup' ); +$fm = new PPOM_InputManager( $field_meta, 'image' ); +$legacy_view = $fm->get_meta_value( 'legacy_view' ); +$multiple_allowed = $fm->get_meta_value( 'multiple_allowed' ); +$show_popup = $fm->get_meta_value( 'show_popup' ); +$max_img_selection = $fm->get_meta_value( 'max_checked' ); $required = isset($field_meta['required']) && $field_meta['required'] === 'on'; $input_classes = $fm->input_classes(); @@ -122,6 +123,7 @@ class="" data-optionid="" data-data_name="data_name() ); ?>" value="" + data-max-selected="" > @@ -223,6 +225,7 @@ class="" data-optionid="" data-data_name="data_name() ); ?>" value="" + data-max-selection="" data-allow-multiple="yes" data-required="yes" diff --git a/woocommerce-product-addon.php b/woocommerce-product-addon.php index 48670e90..2f4512ba 100644 --- a/woocommerce-product-addon.php +++ b/woocommerce-product-addon.php @@ -15,6 +15,7 @@ * * WordPress Available: yes * Requires License: no + * Requires Plugins: woocommerce */ // @since 6.1 @@ -38,7 +39,7 @@ require PPOM_PATH . '/vendor/autoload.php'; -define( 'PPOM_UPGRADE_URL', tsdk_translate_link('https://themeisle.com/plugins/ppom-pro/upgrade/' )); +define( 'PPOM_UPGRADE_URL', 'https://themeisle.com/plugins/ppom-pro/upgrade/' ); add_filter( 'themeisle_sdk_products', function ( $products ) { @@ -101,6 +102,7 @@ function ppom_i18n_setup() { $ppom_admin = new NM_PersonalizedProduct_Admin(); $ppom_basename = plugin_basename( __FILE__ ); add_filter( "plugin_action_links_{$ppom_basename}", 'ppom_settings_link', 10 ); + add_filter( "plugin_action_links_{$ppom_basename}", [ $ppom_admin, 'upgrade_to_pro_plugin_action' ], 10, 2 ); } function PPOM() { @@ -132,7 +134,7 @@ function ( $compatibilities ) { 'primary_color' => '#313350', // optional 'pages' => [ 'woocommerce_page_ppom' ], //pages where the float widget should be displayed 'has_upgrade_menu' => ! defined( 'PPOM_PRO_PATH' ), - 'upgrade_link' => tsdk_utmify( PPOM_UPGRADE_URL, 'float_widget' ), + 'upgrade_link' => tsdk_utmify( tsdk_translate_link( PPOM_UPGRADE_URL ), 'float_widget' ), 'documentation_link' => 'https://rviv.ly/C1cmSQ', 'premium_support_link' => defined( 'PPOM_PRO_PATH' ) ? tsdk_translate_link( tsdk_support_link( PPOM_PRO_PATH . '/ppom.php' ) ) : '', 'feature_request_link' => tsdk_translate_link( 'https://store.themeisle.com/suggest-a-feature/' ),
+ +

+ ', esc_url( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ), '' ); ?> +

+
+

@@ -226,9 +212,9 @@ class="" -

@@ -285,27 +271,17 @@ class="" - +

+ +

- - get_config( 'form_tag' ) ) { ?> diff --git a/classes/admin.class.php b/classes/admin.class.php index dd4e3ba7..cf19899f 100644 --- a/classes/admin.class.php +++ b/classes/admin.class.php @@ -72,7 +72,6 @@ function __construct() { // adding wpml support for PPOM Settings add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'ppom_setting_wpml' ), 10, 3 ); - add_action( 'ppom_pdf_setting_action', 'ppom_admin_update_pro_notice', 10 ); add_action( 'admin_head', array( $this, 'ppom_tabs_custom_style' ) ); @@ -87,9 +86,37 @@ function __construct() { ); add_action( 'admin_init', array( $this, 'set_legacy_user' ) ); - + add_action( 'admin_init', array( $this, 'ppom_create_db_tables' ) ); } + /** + * Add upgrade to pro plugin action link. + * + * @param array $actions Plugin actions. + * @param string $plugin_file Path to the plugin file relative to the plugins directory. + * + * @return array + */ + public function upgrade_to_pro_plugin_action( $actions, $plugin_file ) { + if ( apply_filters( 'product_ppom_license_status', '' ) === 'valid' || apply_filters( 'product_ppom_license_status', '' ) === 'active_expired' ) { + return $actions; + } + + return array_merge( + array( + 'upgrade_link' => '' . __( 'Get Pro', 'woocommerce-product-addon' ) . '', + ), + $actions + ); + + } /* * creating menu page for this plugin @@ -363,6 +390,59 @@ function ppom_tabs_custom_style() { th.column-ppom_meta { width: 10% !important; } + + /* PPOM File Upload uploaded files display */ + td.ppom-files-display { + display: flex; + flex-direction: column; + gap: 3px; + } + + td.ppom-files-display a.button { + text-align: center; + } + + .ppom-settings-container { + display: flex; + flex-direction: column; + gap: 15px; + margin: 10px 15px; + } + + .ppom-settings-container-item { + display: flex; + align-items: center; + gap: 10px; + } + + label.ppom-settings-container-item { + width: 100%; + max-width: 600px; + margin: unset; + } + + .ppom-settings-container .ppom-upsell-link { + display: inline-flex; + align-items: center; + padding: 0.5rem 1rem; + font-size: 0.875rem; + font-weight: 500; + color: #2563eb; + background-color: #eff6ff; + border: 1px solid #bfdbfe; + border-radius: 0.375rem; + text-decoration: none; + transition: all 150ms ease-in-out; + } + + .ppom-settings-container .ppom-upsell-link:hover { + background-color: #dbeafe; + color: #1d4ed8; + } + + .ppom-settings-container .ppom-disabled-text { + color: #8d8d8d; + } esc_html__( 'Export', 'woocommerce-product-addon' ), 'exportLockedLabel'=>esc_html__( 'Export (PRO)', 'woocommerce-product-addon' ), 'importLabel'=>esc_html__( 'Import Field Groups ', 'woocommerce-product-addon' ), - 'importLockedLabel'=>esc_html__( 'Import Field Groups (PRO)', 'woocommerce-product-addon' ), 'freemiumCFRContent' => \PPOM_Freemium::get_instance()->get_freemium_cfr_content(), - 'freemiumCFRTab' => \PPOM_Freemium::TAB_KEY_FREEMIUM_CFR + 'freemiumCFRTab' => \PPOM_Freemium::TAB_KEY_FREEMIUM_CFR, + 'popup' => [ + 'confirmTitle' => __( 'Are you sure?', 'woocommerce-product-addon' ), + 'confirmationBtn' => __( 'Confirm', 'woocommerce-product-addon' ), + 'cancelBtn' => __( 'Cancel', 'woocommerce-product-addon' ), + 'finishTitle' => __( 'Done', 'woocommerce-product-addon' ), + 'errorTitle' => __( 'Error', 'woocommerce-product-addon' ), + 'checkFieldTitle' => __( 'Please at least check one field!', 'woocommerce-product-addon' ), + ] ] ); diff --git a/classes/freemium.class.php b/classes/freemium.class.php index 9e37a87b..3733e0ee 100644 --- a/classes/freemium.class.php +++ b/classes/freemium.class.php @@ -64,7 +64,7 @@ public function add_locked_cfr_tab( $tabs ) { */ public function get_freemium_cfr_content() { ob_start(); - $upgrade_url = tsdk_utmify( PPOM_UPGRADE_URL, 'lockedconditionalfield', 'ppompage' ); + $upgrade_url = tsdk_utmify( tsdk_translate_link( PPOM_UPGRADE_URL ), 'lockedconditionalfield', 'ppompage' ); ?>

diff --git a/classes/plugin.class.php b/classes/plugin.class.php index 426b587a..3244ed20 100644 --- a/classes/plugin.class.php +++ b/classes/plugin.class.php @@ -884,7 +884,7 @@ function show_wc_custom_message() { function ppom_export_meta() { // if( ppom_pro_is_installed() ) return ''; - $buy_pro = tsdk_utmify( PPOM_UPGRADE_URL, 'export-import', 'tryexport' ); + $buy_pro = tsdk_utmify( tsdk_translate_link( PPOM_UPGRADE_URL ), 'export-import', 'tryexport' ); $args = array( 'link_url' => $buy_pro, 'link_text' => 'Buy now', diff --git a/classes/ppom.class.php b/classes/ppom.class.php index 78691342..3a8ce5d3 100644 --- a/classes/ppom.class.php +++ b/classes/ppom.class.php @@ -444,6 +444,7 @@ function inline_css() { if ( $this->ppom_settings->productmeta_style != '' ) { $inline_css = stripslashes( strip_tags( $this->ppom_settings->productmeta_style ) ); + $inline_css = str_replace( 'selector', ".ppom-id-$this->meta_id", $inline_css ); } return apply_filters( 'ppom_inline_css', $inline_css, $this ); diff --git a/css/ppom-admin.css b/css/ppom-admin.css index cf6d291b..4c7c5ac9 100644 --- a/css/ppom-admin.css +++ b/css/ppom-admin.css @@ -1001,7 +1001,7 @@ ul.ppom-options-container li label { .ppom_addons_model_cards_item { display: flex; padding: 1rem; - width: 33%; + width: 50%; } @media only screen and (max-width: 600px) { @@ -1018,6 +1018,7 @@ ul.ppom-options-container li label { display: flex; flex-direction: column; min-height: 240px; + width: 100%; overflow: hidden; } @@ -1169,6 +1170,132 @@ a[data-modal-id="ppom-nm-plugins-modal"] { margin: 10px 0; padding: 10px 5px; } +/* CSS for popup.js */ +.ppom-popup-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; +} + +.ppom-popup { + background: #fff; + border-radius: 8px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + width: 500px; + padding: 40px 50px 20px; + text-align: center; +} + +.ppom-popup-container { + display: flex; + flex-direction: column; + align-items: center; + + gap: 20px; +} + +.ppom-popup-title { + font-size: 2.5em; + margin: 0; + line-height: 1.3; + + color: #4caf50; +} + +.ppom-popup-text { + font-size: 1.4em; + line-height: 1.3; + margin: 0; +} + +.ppom-popup-actions { + display: flex; + justify-content: space-evenly; + width: 100%; +} + +.ppom-popup-actions button { + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 1.3em; + transition: background-color 0.3s ease; + min-width: 110px; + + color: #fff; + background-color: #4caf50; +} + +.ppom-popup-actions button:hover { + background-color: #4588a0; +} + +.ppom-popup-actions .ppom-btn-cancel { + background-color: #6c757d; +} + +.ppom-popup.ppom-error .ppom-popup-title { + color: #f44336; +} + +.ppom-popup.ppom-error .ppom-btn-confirm { + background-color: #f44336; +} + +.ppom-hide { + display: none; +} +.ppom-disabled-overlay { + opacity: 0.6; + pointer-events: none; +} + +.ppom-wrapper label { + cursor: auto; +} + +#ppom-import-upsell{ + text-align: center; + width: 600px; +} +#ppom-import-upsell .ppom-modal-body{ + position: relative; + padding: 30px; +} +#ppom-import-upsell button.close-model { + position: absolute; + right: 10px; + top: 10px; + background: transparent; + border: 0; + padding: 0; + font-size: 20px; +} + +#ppom-import-upsell .ppom-lock-icon { + padding-bottom: 30px; +} + +#ppom-import-upsell .ppom-lock-icon .dashicons { + width: 48px; + height: 48px; + font-size: 48px; +} + +#ppom-import-upsell p { + font-size: 16px; + text-align: left; + padding-bottom: 10px; + padding-top: 20px; + .ppom-admin-tabs-css .ppom-admin-tab-content .notice-info p { margin: 0; } \ No newline at end of file diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 00000000..57e500a5 --- /dev/null +++ b/global.d.ts @@ -0,0 +1,133 @@ +interface PopupOptions { + title?: string; + text?: string; + hideCloseBtn?: boolean; + type?: 'error' | 'success'; + onConfirmation?: () => void; + onClose?: () => void; +} + +export declare class Popup { + overlay: HTMLDivElement; + popup: HTMLDivElement; + container: HTMLDivElement; + title: HTMLHeadingElement; + text: HTMLParagraphElement; + confirmButton: HTMLButtonElement; + cancelButton: HTMLButtonElement; + onConfirmation: () => void; + onClose: () => void; + + constructor(); + open(options?: PopupOptions): void; + close(): void; + confirm(): void; + show(): void; + hide(): void; +} + +interface GlobalVars { + i18n: { + addGroupUrl: string; + addGroupLabel: string; + bulkActionsLabel: string; + deleteLabel: string; + exportLabel: string; + exportLockedLabel: string; + importLabel: string; + importLockedLabel: string; + freemiumCFRContent: string; + freemiumCFRTab: string; + popup: { + confirmTitle: string; + confirmationBtn: string; + cancelBtn: string; + finishTitle: string; + errorTitle: string; + checkFieldTitle: string; + } + } +} + +interface BulkQuantityGlobal { + i18n: { + validation: { + end_bigger_than_start: string; + start_cannot_be_equal_with_end: string; + range_intersection: string; + invalid_pattern: string; + } + } +} + +interface FileUploadGlobal { + ajaxurl: string; + plugin_url: string; + file_upload_path_thumb: string; + file_upload_path: string; + mesage_max_files_limit: string; + file_inputs: any[]; + delete_file_msg: string; + plupload_runtime: string; + croppie_options: { + viewport: { + width: number; + height: number; + type: string; + }, + boundary: { + width: number; + height: number; + }, + enableExif: boolean; + enforceBoundary: boolean; + enableZoom: boolean; + showZoomer: boolean; + }[]; + ppom_file_upload_nonce: string; + ppom_file_delete_nonce: string; + enable_file_rename: boolean; + product_id: number; +} + +interface InputVarsGlobal { + ajaxurl: string; + ppom_inputs: any[]; + field_meta: any[]; + ppom_validate_nonce: string; + wc_thousand_sep: string; + wc_currency_pos: string; + wc_decimal_sep: string; + wc_no_decimal: number; + wc_product_price: number; + wc_product_regular_price: number; + total_discount_label: string; + price_matrix_heading: string; + product_base_label: string; + option_total_label: string; + fixed_fee_heading: string; + total_without_fixed_label: string; + product_quantity_label: string; + product_title: string; + per_unit_label: string; + show_price_per_unit: boolean; + text_quantity: string; + show_option_price: boolean; + is_shortcode: string; + plugin_url: string; + is_mobile: boolean; + product_id: number; + tax_prefix: string; +} + +/** + * Define global variables to allow IDE auto-completion and checking. + */ +declare global { + interface Window { + ppomPopup?: Popup; + ppom_vars: GlobalVars; + ppom_file_vars: FileUploadGlobal; + ppom_input_vars: InputVarsGlobal + } +} \ No newline at end of file diff --git a/inc/admin.php b/inc/admin.php index ff4b51ee..6854de59 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -80,51 +80,113 @@ function ppom_meta_list( $post ) { $ppom = new PPOM_Meta( $post->ID ); $all_meta = PPOM()->get_product_meta_all(); $ppom_setting = admin_url( 'admin.php?page=ppom' ); + + $html = '
'; + + // UP-SELL + $html .= ''; + $html .= ' '; + $html .= __( 'Using multiple PPOM Fields on the same product is available in PRO.', 'woocommerce-product-addon' ); + $html .= ''; + + // PPOM Fields select table. + $html .= ''; + + $html .= '
'; + $html .= ''; + $html .= '' . __( 'Create New Meta', 'woocommerce-product-addon' ) . ''; + $html .= '
'; - $html = '
'; - $html .= '

' . __( 'Select Meta to Show Fields on this product', 'woocommerce-product-addon' ); - // $html .= __(' Or Create New Meta', 'woocommerce-product-addon'); - $html .= '

'; - - $html .= '

'; - $html .= '

'; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + foreach ( $all_meta as $meta ) { + $html .= ''; + + // Select/Checkbox + $html .= ''; - $html .= ''; - } - $html .= ''; + // ID Column + $html .= ''; - if ( $ppom->single_meta_id != 'None' ) { + // Meta Name Column + $html .= ''; - $ppom_add_args = array( - 'productmeta_id' => $ppom->single_meta_id, - 'do_meta' => 'edit', - 'product_id' => $post->ID, + // Edit Meta Shortcut Column + $url_edit = add_query_arg( + array( + 'productmeta_id' => $meta->productmeta_id, + 'do_meta' => 'edit', + ), + $ppom_setting ); - $url_edit = add_query_arg( $ppom_add_args, $ppom_setting ); - $html .= ' '; - } + $html .= ''; - // $html .= '
'; - // $html .= ' Create New Meta'; + $html .= ''; + } - $html .= '

'; + $html .= '
' . __( 'Select Meta', 'woocommerce-product-addon' ) . '' . __( 'Meta ID', 'woocommerce-product-addon' ) . '' . __( 'Meta Name', 'woocommerce-product-addon' ) . '' . __( 'Edit', 'woocommerce-product-addon' ) . '
'; + $html .= 'meta_id ) && + ( + ( + is_array( $ppom->meta_id ) && + in_array( $meta->productmeta_id, $ppom->meta_id ) + ) || + ( + is_numeric( $ppom->meta_id ) && + $ppom->meta_id === $meta->productmeta_id + ) + ) + ) { + $html .= ' checked '; + } + $html .= 'id="ppom-' . esc_attr( $meta->productmeta_id ) . '">'; + $html .= '' . $meta->productmeta_id . '' . stripslashes( $meta->productmeta_name ) . ''; + $html .= ''; + $html .= '
'; $html .= '
'; - $ppom_add_args = array( - 'action' => 'new', - 'product_id' => $post->ID, - ); - $ppom_setting_url = add_query_arg( $ppom_add_args, $ppom_setting ); + $html .= '
'; + $html .= '
'; + $html .= '' . __( 'PPOM PopUp Settings', 'woocommerce-product-addon' ) . ' (' . __( 'PRO', 'woocommerce-product-addon' ) . ')' . ''; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= '
'; + $html .= '' . __( 'PPOM Enquiry Form Settings', 'woocommerce-product-addon' ) . ' (' . __( 'PRO', 'woocommerce-product-addon' ) . ')' . ''; + $html .= ''; + $html .= '
'; + + ?> + + '; - echo '' . __( 'Add more field types', 'woocommerce-product-addon' ) . ''; - echo '
'; -} diff --git a/inc/arrays.php b/inc/arrays.php index e5a640bf..cd8aad52 100644 --- a/inc/arrays.php +++ b/inc/arrays.php @@ -255,7 +255,7 @@ function ppom_array_settings() { 'label' => __( 'Yes', 'woocommerce-product-addon' ), 'default' => 'no', 'id' => 'ppom_disable_bootstrap', - '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' ), ), array( @@ -264,7 +264,7 @@ function ppom_array_settings() { 'label' => __( 'Yes', 'woocommerce-product-addon' ), 'default' => 'no', 'id' => 'ppom_enable_legacy_inputs_rendering', - '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' ), ), array( @@ -281,6 +281,7 @@ function ppom_array_settings() { 'label' => __( 'Yes', 'woocommerce-product-addon' ), 'default' => 'no', 'id' => 'ppom_legacy_price', + 'desc' => __( 'Enable this option to use the legacy method for price calculations.', 'woocommerce-product-addon' ), ), array( 'title' => __( 'PPOM Permissions', 'woocommerce-product-addon' ), @@ -290,7 +291,7 @@ function ppom_array_settings() { 'placeholder' => 'choose role', 'options' => ppom_get_all_editable_roles(), 'id' => 'ppom_permission_mfields', - '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' ), 'desc_tip' => true, ), @@ -363,7 +364,7 @@ function ppom_array_settings() { 'label' => __( 'Yes', 'woocommerce-product-addon' ), 'default' => 'no', 'id' => 'ppom_api_enable', - 'desc' => __( 'Check this option to enable PPOM REST API', 'woocommerce-product-addon' ), + 'desc' => __( 'Check this option to enable PPOM REST API.', 'woocommerce-product-addon' ), ), array( @@ -671,422 +672,57 @@ function ppom_array_get_addons_details() { $addons = array( array( - 'title' => __( 'Personalization Preview', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Personalization Preview Addon is the best and simple solution for web2print business using WooCommerce. Now define a fixed position and area for Text in your Templates like on Mug, T-shirt or Visiting Cards with preset font family, size. The client will fill the text with his all of its attributes and send to cart. It’s like a smart Product Designer. Multiple templates can also be attached to one product.', 'woocommerce-product-addon' ), + 'title' => __( '30+ Premium Field Types', 'woocommerce-product-addon' ), + 'desc' => __( 'PPOM Pro expands your product customization options with over 30 advanced field types, including Date Picker, Image Cropper, Quantities Pack, and Color Picker. These powerful fields allow you to create tailored product flows, offering customers a highly personalized shopping experience and enabling more dynamic interactions with your products.', 'woocommerce-product-addon' ), 'actions' => array( array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#texter', + 'title' => __( 'Documentation', 'woocommerce-product-addon' ), + 'link' => 'https://docs.themeisle.com/article/1801-what-is-the-difference-between-ppom-free-and-ppom-pro', ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Fixed Price', 'woocommerce-product-addon' ), - 'desc' => __( 'Sometimes prices are very complex like for a printing company, they are selling their visiting cards in Packages.So Package Price Add-on allows admin to set prices against package. It’s usage is very simple, just add quantity (package) and it’s price. There is also option to set unit like you are selling visiting cards then unit may called as “cards”.', 'woocommerce-product-addon' ), - 'actions' => array(), - 'type' => 'field' - ), - array( - 'title' => __( 'Fields PopUp', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Fields PopUp wrap all PPOM fields inside a popup. A product with large number of fields can now has simple button with customized label. To enable this PopUp just one click required in product edit page. ', 'woocommerce-product-addon' ), - 'actions' => array(), - 'type' => 'feature' - ), - array( - 'title' => __( 'Font Picker', 'woocommerce-product-addon' ), - 'desc' => __( 'Font selector loads fonts from Google and client can pick font and can see live preview of font effect. Admin can also filter font families and set Custom Fonts.', 'woocommerce-product-addon' ), - 'actions' => array( array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#fonts-picker', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Image DropDown', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Image DropDown Addon show images inside a select box. The title, description, and prices can be added along with all images. It’s best when you have a long list of images and don’t want to use Image Type input.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#image-dropdown', + 'title' => __( 'Demo', 'woocommerce-product-addon' ), + 'link' => 'https://demo-ppom-lite.vertisite.cloud/', ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Bulk Quantity Options', 'woocommerce-product-addon' ), - 'desc' => __( 'Bulk Quantity for Options Addon allow store admin to set discount prices for each options. This Addon is best tool for companies like Printin, designing and who looking to sale products with options with different prices.', 'woocommerce-product-addon' ), - 'actions' => array(), + ), 'type' => 'field' ), array( 'title' => __( 'Cart Edit', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Cart Edit Addon allow clients to edit fields once these are added to cart on cart page. It has also option to show all meta fields in different column on cart page. Extra column can be disable from Settings -> PPOM Cart tab.', 'woocommerce-product-addon' ), - 'actions' => array(), - 'type' => 'feature' - ), - array( - 'title' => __( 'Domain Checker', 'woocommerce-product-addon' ), - 'desc' => __( 'Domain Checker Addon will check any domain’s availability. Adds domain to cart if it’s not already registered. A simple solution to sell domains with WooCommerce PPOM. Customized messages for domain availability/not-availability. Ajax base script to check domain and show result.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#domain', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Quantities Pack', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Quantity Pack Add-on is a special input type which is very similar to Variation Quantities input but with a good difference. Like if you are want to sell some products with different options in specific quantities, not sure?', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#quantities-pack', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Super List', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Super List addon contains many pre-defined lists to render as Select field on product page. It includes Countries, Currencies, Months etc. ', 'woocommerce-product-addon' ), + 'desc' => __( 'The Cart Edit addon can help the visitors of your website easily change their orders to suit their needs while they\'re checking the cart. By enabling this, an Edit Options button will appear in the cart under the products\' names. This will get visitors to the product\'s page to change their choices.', 'woocommerce-product-addon' ), 'actions' => array( array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#super-list', + 'title' => __( 'Documentation', 'woocommerce-product-addon' ), + 'link' => 'https://docs.themeisle.com/article/1793-how-to-enable-the-cart-edit-in-ppom', ), ), - 'type' => 'field' - ), - array( - 'title' => __( 'Collapse', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Field Collapsed Add-on is front-end design which groups field inside beautiful section. Like steps, and if your product has a large number of fields then it is the best add-on to a short length of your product page.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#collapse', - ), - ), - 'type' => 'field' + 'type' => 'feature' ), array( - 'title' => __( 'Text Counter', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Text Counter Add-on is special type text input field. It can restrict a total number of words or character with nice info panel below. Each word or character can be changed and the price will be added to cart.', 'woocommerce-product-addon' ), + 'title' => __( 'Conditional Field Repeater', 'woocommerce-product-addon' ), + 'desc' => esc_html__( 'Conditional Field Repeater allows you to duplicate PPOM fields, enabling customers to repeat a set of options for multiple entries. This is perfect for scenarios where customers need to provide varied input for the same product, like ordering shirts with multiple custom text lines to be printed.', 'woocommerce-product-addon' ), 'actions' => array( array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#text-counter', + 'title' => __( 'Documentation', 'woocommerce-product-addon' ), + 'link' => 'https://docs.themeisle.com/article/1700-personalized-product-meta-manager#conditional-repeater', ), ), - 'type' => 'field' + 'type' => 'feature' ), array( 'title' => __( 'Enquiry Form', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Enquiry Form Add-on adds button on product page. A customer can ask the admin about any product with PPOM Field in email. All PPOM Meta Fields are sent with message typed by the customer. Multiple email recipients can be added for product enquiry.', 'woocommerce-product-addon' ), + 'desc' => __( 'Enquiry Form Add-on enhances your product pages by adding a customizable enquiry button. It allows customers to send inquiries directly to the admin about products with PPOM Fields via email. All associated PPOM Meta Fields are included in the customer\'s message.', 'woocommerce-product-addon' ), 'actions' => array(), 'type' => 'feature' ), array( - 'title' => __( 'Variation Quantity Matrix', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Variation Quantity Matrix Add-on is an advanced form of Variation Quantity Field. Variation Quantity Matrix is a super simple form when quantities need to be collected against multiple options. Like if you selling T-Shirt and need to collect Quantities against each Color of each Size, this Add-on can be used to render a Tabular/Grid. ', 'woocommerce-product-addon' ), + 'title' => __( 'Fields Popup', 'woocommerce-product-addon' ), + 'desc' => __( 'The Fields Popup addon allows the PPOM meta fields to be displayed inside a popup on the product page.', 'woocommerce-product-addon' ), 'actions' => array( array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#variation-matrix', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Quantity Option', 'woocommerce-product-addon' ), - 'desc' => __( 'PPOM Quantity Option Add-on is simple ‘Number’ input type which can be used to accept option quantity BUT Price can also be set. Like for a Pizza Product, customer have a option to order more then one drink and each extra drink as price. Here this Option Quantity will do the trick. This Add-on can be used as Name your Price.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#quantity-option', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Emojis', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'The Emoji field adds emoji support to the input (can be textarea, text, dropdown.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#emojis', - ), - array( - 'title' => __( 'Screenshot (Front)', 'woocommerce-product-addon' ), - 'link' => 'https://vertis.d.pr/i/vp3wRy', - ), - array( - 'title' => __( 'Screenshot (Admin)', 'woocommerce-product-addon' ), - 'link' => 'https://vertis.d.pr/i/9SaoOW', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Phone Input', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'The Phone field provides a formatted text input field with a country selection dropdown.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#phone-input', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Chained Input', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Allows to create chained dropdown options.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#chained-input', - ), - array( - 'title' => __( 'Screenshot (Front)', 'woocommerce-product-addon' ), - 'link' => 'https://vertis.d.pr/i/kFexj7', - ), - array( - 'title' => __( 'Screenshot (Admin)', 'woocommerce-product-addon' ), - 'link' => 'https://vertis.d.pr/i/j4ZiNf', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Conditional Images', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'That field is used to show dependent fields according to the selected image.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#conditional-images', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Select Option Quantity', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'This input allows you to display a dropdown with options along with their quantities.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#select-option', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Radio Switcher', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'The Radio Switcher input creates a more appealing view for the product page, and it allows different images for each option.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#radio-switcher', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Date Range Input', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Date Range Picker allows clients to select dates, times, or from predefined ranges.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#date-range-picker', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-date-range-input/', + 'title' => __( 'Documentation', 'woocommerce-product-addon' ), + 'link' => 'https://docs.themeisle.com/article/1982-how-to-configure-the-field-popup-in-ppom', ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Color Picker', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Color Picker allows the client to select a color. Palette colors can also be defined in settings.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#color-picker-input', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-color-picker/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'File Input', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'File Input allows clients to upload files from their computers or mobile devices. Admin can set any file type and size.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#file-upload', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-file-upload-input/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Image Cropper', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Just like a File Upload but only supports images with a nice cropper using Croppie JS API.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#image-cropper', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-basic-image-cropping-input/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Timezone Input', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Timezone input is a unique form of Select Input, but it has a predefined list of all Time-zones. Different Time-zones can also be filtered with options.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#timezone-input', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-timezone-with-region/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Variation Quantity', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Variation Quantities allow clients to order different quantities against different options.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#variation-quantities', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-variation-quantities/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Images', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Image input is just like Radio/Checkbox, but images can be uploaded against each option. Price can also be set against each image option.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#image-option-input', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-images-options/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Price Matrix', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Price Matrix allows admin to offer client Less Price on Bulk/More quantities. More quantities will decrease the price set in the matrix.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#price-matrix', - ), - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-price-matrix-discount/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'HTML', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'It’s not input, just to add content/text or HTML. Added HTML is shown on product details.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#html-content', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-basic-html-with-content/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Color Palettes', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Display the variations of the products using the Color Palettes. You create the palette from the colors which you wish.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#color-palettes', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-color-palette/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Audio / Video', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Audio/Video input allows clients to select Audio/Video options uploaded by Admin in the media library. It’s similar to Image type input but with a different media type. Price can also be set against each option.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#audio-video-input', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-video-audio/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Measure Input', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Depending on the products that you provide, some of them could require some measurement specifications, and this can be done using Measure Input.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#measure-input', - ), - array( - 'title' => __( 'Demo', 'woocommerce-product-addon' ), - 'link' => 'https://demo-ppom-lite.vertisite.cloud/product/demo-for-measure-input/', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Divider', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'This input allows you to define each meta field better and to create a more attractive design for your products.', 'woocommerce-product-addon' ), - 'actions' => array( - array( - 'title' => __( 'Docs', 'woocommerce-product-addon' ), - 'link' => 'https://docs.themeisle.com/article/1702-ppom-pro-input-types#divider', - ), - ), - 'type' => 'field' - ), - array( - 'title' => __( 'Conditional Field Repeater', 'woocommerce-product-addon' ), - 'desc' => esc_html__( 'Conditional Field Repeater is a feature used to repeat a PPOM field by the value of another PPOM field (number field).', 'woocommerce-product-addon' ), - 'actions' => array(), + ), 'type' => 'feature' ), ); diff --git a/inc/files.php b/inc/files.php index 484559ba..db7a67ab 100644 --- a/inc/files.php +++ b/inc/files.php @@ -345,17 +345,20 @@ function ppom_upload_file() { // Deleting file function ppom_delete_file() { - $file_name = sanitize_file_name( $_REQUEST ['file_name'] ); + if ( ! isset( $_REQUEST ['file_name'] ) || ! isset( $_REQUEST['ppom_nonce'] ) ) { + echo __( 'Missing data.', 'woocommerce-product-addon' ); + die( 0 ); + } - $ppom_nonce = $_REQUEST['ppom_nonce']; + $file_name = sanitize_file_name( $_REQUEST ['file_name'] ); + $ppom_nonce = sanitize_key( $_REQUEST['ppom_nonce'] ); $file_nonce_action = 'ppom_deleting_file_action'; if ( ! wp_verify_nonce( $ppom_nonce, $file_nonce_action ) ) { - printf( __( 'Error while deleting file %s', 'woocommerce-product-addon' ), $file_name ); + printf( __( 'Verification failed for file: %s', 'woocommerce-product-addon' ), $file_name ); die( 0 ); } - $dir_path = ppom_get_dir_path(); - + $dir_path = ppom_get_dir_path(); $file_path = $dir_path . $file_name; if ( file_exists( $file_path ) && unlink( $file_path ) ) { @@ -379,7 +382,7 @@ function ppom_delete_file() { printf( __( 'Error while deleting file %s', 'woocommerce-product-addon' ), $file_path ); } } else { - printf( __( 'Error while deleting file %s', 'woocommerce-product-addon' ), $file_path ); + printf( __( 'The file %s does not exists.', 'woocommerce-product-addon' ), $file_path ); } die( 0 ); @@ -477,7 +480,7 @@ function ppom_uploaded_file_preview( $file_name, $settings ) { // Tools group $file_tools .= '
'; // $file_tools .= ''; - $file_tools .= '' . __( 'Delete', 'woocommerce-product-addon' ) . ''; + $file_tools .= ''; if ( apply_filters( 'ppom_show_image_popup', false ) ) { $file_tools .= ''; @@ -491,8 +494,10 @@ function ppom_uploaded_file_preview( $file_name, $settings ) { $file_meta .= __( 'Size: ', 'woocommerce-product-addon' ) . ppom_get_filesize_in_kb( $file_name ); $thumb_url = PPOM_URL . '/images/file.png'; - $file_tools .= ''; // delete icon - // $file_tools .= 'Delete'; //delete icon + // Tools group + $file_tools .= '
'; + $file_tools .= ''; + $file_tools .= '
'; } diff --git a/inc/functions.php b/inc/functions.php index aa7663f1..916813ab 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1541,10 +1541,16 @@ function ppom_extract_matrix_by_quantity( $quantities_field, $product, $quantity return $matrix; } -// Return thumbs size -function ppom_get_thumbs_size() { +/** + * Thumbnail image size. + * + * @param int $size Image size. + * + * @return string + */ +function ppom_get_thumbs_size( $size = 150 ) { - return apply_filters( 'ppom_thumbs_size', '150px' ); + return apply_filters( 'ppom_thumbs_size', sprintf( '%dpx', absint( $size ) ) ); } // Return file size in kb @@ -1574,36 +1580,45 @@ function ppom_generate_html_for_files( $file_names, $input_type, $item ) { foreach ( $file_name_array as $file_name ) { $file_edit_path = ppom_get_dir_path( 'edits' ) . ppom_file_get_name( $file_name, $item->get_product_id() ); - // Making file thumb download with new path $ppom_file_url = ppom_get_file_download_url( $file_name, $item->get_order_id(), $item->get_product_id() ); - $ppom_file_thumb_url = ppom_is_file_image( $file_name ) ? ppom_get_dir_url( true ) . $file_name : PPOM_URL . '/images/file.png'; - $order_html .= '
'; - $order_html .= ''; - $order_html .= '
'; + if ( $is_image_file ) { + $order_html .= ''; + } + + $order_html .= ''; + + if ( $is_image_file ) { + $order_html .= ''; + } // Requested by Kevin, hiding downloading file button after order on thank you page // @since version 16.6 if ( is_admin() ) { - $order_html .= ''; + $order_html .= ''; $order_html .= __( 'Download File', 'woocommerce-product-addon' ); - $order_html .= '
'; + $order_html .= '
'; $order_html .= ''; $order_html .= ''; + $order_html .= ''; $order_html .= __( 'Cropped', 'woocommerce-product-addon' ); $order_html .= '
'; + $order_html .= '
'; $order_html .= ''; $order_html .= ''; @@ -1638,7 +1653,7 @@ function ppom_generate_html_for_images( $images ) { $images_meta = json_decode( stripslashes( $images_meta ), true ); $image_url = stripslashes( $images_meta['link'] ); $image_label = isset( $images_meta['raw'] ) ? $images_meta['raw'] : ''; - $image_html = ''; + $image_html = ''; $ppom_html .= '
' . $image_html . '' . esc_attr( ppom_files_trim_name( $image_label ) ) . '