Showing with 88 additions and 40 deletions.
  1. +1 −3 .github/ISSUE_TEMPLATE/Bug_report.yml
  2. +8 −0 CHANGELOG.md
  3. +19 −20 composer.lock
  4. +21 −4 inc/admin.php
  5. +1 −1 inc/validation.php
  6. +19 −6 js/admin/ppom-admin.js
  7. +3 −1 js/ppom-conditions-v2.js
  8. +1 −1 package.json
  9. +13 −2 readme.txt
  10. +2 −2 woocommerce-product-addon.php
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/Bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ body:
attributes:
label: Is the issue you are reporting a regression
description: |
i.e, a previously working feature/functionality is now broken?
By specifying whether or not your issue is a regression, it will help the development team to more effectively diagnose and resolve the problem.
Choose "Yes" if the bug appeared after updating the product, meaning it worked before but not now. Choose "No" if the bug isn't caused by an update. Marking a bug as regression helps us fix issues from new changes faster.
multiple: false
options:
- 'No'
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
##### [Version 32.0.5](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.4...v32.0.5) (2023-04-11)

* [Fix] Implemented input sanitization for PPOM Field Input during the first save on PPOM Group creation.
* [Fix] [PPOM Pro] Fixed issue where Cart Edit feature caused loss of field selections on product page.
* [Fix] Fixed issue where duplicated button failed to copy field unless renamed and saved.
* [Fix] Fixed issue with deleting PPOM groups causing PHP notice in WP Debug mode.
* Themeisle SDK update

##### [Version 32.0.4](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.3...v32.0.4) (2023-03-31)

- [Fix] The options of the meta field are not visible on smaller window size
Expand Down
39 changes: 19 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function ppom_admin_update_ppom_meta_only( $ppom_id, $ppom_meta ) {
global $wpdb;

$dt = array(
'the_meta' => json_encode( $ppom_meta ),
'the_meta' => wp_json_encode( ppom_sanitize_array_data( $ppom_meta ) ),
);

// ppom_pa($dt); exit;
Expand Down Expand Up @@ -553,18 +553,35 @@ function ppom_admin_delete_selected_meta() {
if ( ! isset( $_POST['ppom_meta_nonce'] )
|| ! wp_verify_nonce( $_POST['ppom_meta_nonce'], 'ppom_meta_nonce_action' )
|| ! ppom_security_role()
|| ! array_key_exists( 'productmeta_ids', $_POST )
|| ! is_array( $_POST['productmeta_ids'] )
) {
_e( 'Sorry, you are not allowed to perform this action', 'woocommerce-product-addon' );
die( 0 );
}

global $wpdb;

extract( $_REQUEST );
$productmeta_ids = implode( ', ', $productmeta_ids );
$del_ids = [];
$del_ids_ph = [];

// for the performance wise, prefer to use foreach instead of array_map-array_filter-array_fill stack.
foreach( $_POST['productmeta_ids'] as $id ) {
$id = absint( $id );

if( 0 === $id ) {
continue;
}

$del_ids[] = $id;
$del_ids_ph[] = '%d';
}

$del_ids_ph = implode( ', ', $del_ids_ph );

$tbl_name = $wpdb->prefix . PPOM_TABLE_META;

$res = $wpdb->query( $wpdb->prepare( "DELETE FROM {$tbl_name} WHERE productmeta_id IN ({$productmeta_ids})", $productmeta_ids ) );
$res = $wpdb->query( $wpdb->prepare( "DELETE FROM {$tbl_name} WHERE productmeta_id IN ({$del_ids_ph})", $del_ids ) );

if ( $res ) {
_e( 'Meta deleted successfully', 'woocommerce-product-addon' );
Expand Down
2 changes: 1 addition & 1 deletion inc/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function ppom_sanitize_array_data( $array ) {
if ( is_array( $value ) ) {
$value = ppom_sanitize_array_data( $value );
} else {
if ( in_array( $key, ppom_fields_with_html() ) ) {
if ( in_array( $key, ppom_fields_with_html(), true ) ) {
$value = ppom_esc_html( $value );
} else {
$value = sanitize_text_field( $value );
Expand Down
25 changes: 19 additions & 6 deletions js/admin/ppom-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ jQuery(function($) {
html += '<button class="ppom-edit-field btn" id="' + id + '" data-modal-id="ppom_field_model_' + id + '"><i class="fa fa-pencil" aria-hidden="true"></i></button>';
html += '</td>';
html += '</tr>';

html = $.parseHTML(html);
// console.log(copy_model_id);
if (copy_model_id != '' && copy_model_id != undefined) {
$(html).find('.ppom_field_table tbody').end().insertAfter('#ppom_sort_id_' + copy_model_id + '');
Expand Down Expand Up @@ -386,11 +386,11 @@ jQuery(function($) {

var row = $('.ppom_field_table tbody').find('.row_no_' + id);

row.find(".ppom_meta_field_title").html(title);
row.find(".ppom_meta_field_id").html(data_name);
row.find(".ppom_meta_field_type").html(type);
row.find(".ppom_meta_field_plchlder").html(placeholder);
row.find(".ppom_meta_field_req").html(_ok);
row.find(".ppom_meta_field_title").text(title);
row.find(".ppom_meta_field_id").text(data_name);
row.find(".ppom_meta_field_type").text(type);
row.find(".ppom_meta_field_plchlder").text(placeholder);
row.find(".ppom_meta_field_req").text(_ok);

$(".ppom-modal-box, .ppom-modal-overlay").fadeOut('fast', function() {
$(".ppom-modal-overlay").remove();
Expand Down Expand Up @@ -493,6 +493,19 @@ jQuery(function($) {
// console.log(model_id_no);

var clone_new_field = $('.ppom_save_fields_model #ppom_field_model_' + model_id_no + '').clone(true);
var dataTitleField = clone_new_field.find( '[data-metatype="title"]' );
var dataNameField = clone_new_field.find( '[data-metatype="data_name"]' );
var dataNameOldVal = dataNameField.val();
var duplicateFields = jQuery(document).find('.ppom_field_table .ppom_meta_field_title:contains(' + dataTitleField.val() + ')');
var dataNameNewVal = '';
var reg = '/_copy_/';
if ( duplicateFields && duplicateFields.length >= 1 ) {
dataNameOldVal = dataNameOldVal.split( '_copy_' ).shift();
dataNameNewVal = dataNameOldVal + '_copy_' + duplicateFields.length++;
} else {
dataNameNewVal = dataNameOldVal + '_copy';
}
dataNameField.val( dataNameNewVal );
// clone_new_field.find('.ppom_save_fields_model').end().appendTo('.ppom_save_fields_model').attr('id','ppom_field_model_'+field_no+'');
clone_new_field.find('.ppom_save_fields_model').end().insertAfter('#ppom_field_model_' + model_id_no + '').attr('id', 'ppom_field_model_' + field_no + '');
clone_new_field.find('.ppom-add-fields-js-action').attr('data-field-index', field_no);
Expand Down
4 changes: 3 additions & 1 deletion js/ppom-conditions-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,9 @@ function ppom_set_default_option(field_id) {
case 'text':
case 'date':
case 'number':
jQuery("#" + field.data_name).val(field.default_value);
if ( '' === jQuery("#" + field.data_name).val() ) {
jQuery("#" + field.data_name).val(field.default_value);
}
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woocommerce-product-addon",
"version": "32.0.4",
"version": "32.0.5",
"description": "PPOM for WooCommerce",
"main": "index.js",
"repository": "https://github.com/Codeinwp/woocommerce-product-addon",
Expand Down
15 changes: 13 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: themeisle
Tags: woocommerce product addons, woocommerce product options, woocommerce product fields, woocommerce product, woocommerce product addon
Requires at least: 3.5
Tested up to: 6.1
Stable tag: 32.0.4
Tested up to: 6.2
Stable tag: 32.0.5
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 7.2
Expand Down Expand Up @@ -122,6 +122,17 @@ If you feels that PPOM Free or PPOM PRO versions are not enough for your needs,

== Changelog ==

##### [Version 32.0.5](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.4...v32.0.5) (2023-04-11)

* [Fix] Implemented input sanitization for PPOM Field Input during the first save on PPOM Group creation.
* [Fix] [PPOM Pro] Fixed issue where Cart Edit feature caused loss of field selections on product page.
* [Fix] Fixed issue where duplicated button failed to copy field unless renamed and saved.
* [Fix] Fixed issue with deleting PPOM groups causing PHP notice in WP Debug mode.
* Themeisle SDK update




##### [Version 32.0.4](https://github.com/Codeinwp/woocommerce-product-addon/compare/v32.0.3...v32.0.4) (2023-03-31)

- [Fix] The options of the meta field are not visible on smaller window size
Expand Down
4 changes: 2 additions & 2 deletions woocommerce-product-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: PPOM for WooCommerce
* Plugin URI: https://themeisle.com/plugins/ppom-pro/
* Description: PPOM (Personalized Product Meta Manager) plugin allow WooCommerce Store Admin to create unlimited input fields and files to attach with Product Pages.
* Version: 32.0.4
* Version: 32.0.5
* Author: Themeisle
* Text Domain: woocommerce-product-addon
* Domain Path: /languages
Expand All @@ -26,7 +26,7 @@
define( 'PPOM_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'PPOM_WP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __DIR__ ) ) );
define( 'PPOM_BASENAME', basename( PPOM_WP_PLUGIN_DIR ) );
define( 'PPOM_VERSION', '32.0.4' );
define( 'PPOM_VERSION', '32.0.5' );
define( 'PPOM_DB_VERSION', '30.1.0' );
define( 'PPOM_PRODUCT_META_KEY', '_product_meta_id' );
define( 'PPOM_TABLE_META', 'nm_personalized' );
Expand Down