34 changes: 1 addition & 33 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,25 @@
CONTRIBUTING.md
.distignore
.gitignore
.travis.yml
.jshintrc
.commitlintrc.js
docker-compose.yml
Gruntfile.js
grunt
phpcs.xml
node_modules
logs
e2e-tests
cypress.json
.eslintignore
.eslintrc.js
.releaserc.yml
.gitattributes
.babelrc
.eslintrc
.github
package.json
bin
tests
phpunit.xml
npm-debug.log
package-lock.json
webpack.config.js
dist
.nvmrc
.editorconfig
*.pdf
artifact
composer.json
composer.lock
themeisle.enc

assets/css/src
assets/js/src

.idea
vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php
**/*.css.map
.DS_Store
blackfire
rollup.config.js
docker-compose.ci.yml
visual-regressions
yarn.lock
.ds_store
.storybook
stories
cypress.storybook.json
tsconfig.json
lint-staged.config.js
.stylelintrc.json
phpstan.neon
.gitkeep
3 changes: 3 additions & 0 deletions .github/workflows/create-build-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
types: [ opened, synchronize, ready_for_review ]
branches-ignore:
- "update_dependencies"
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
dev-zip:
name: Build ZIP and upload to s3
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##### [Version 30.1.3](https://github.com/Codeinwp/woocommerce-product-addon/compare/v30.1.2...v30.1.3) (2022-09-02)

- [Fix] Browser console logs have been removed.
- [Fix] The bug that occurs when a group saving empty fields has been fixed.
- [Tweak] Do not allow removing of the Administrator role from PPOM Permissions

##### [Version 30.1.2](https://github.com/Codeinwp/woocommerce-product-addon/compare/v30.1.1...v30.1.2) (2022-08-15)

- [Fix] A PHP Notice fixed and a technical improvement has been made.
Expand Down
21 changes: 21 additions & 0 deletions backend/assets/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,25 @@ jQuery(function($) {
Select2 Init
**/
$('.nmsf-multiselect-js').select2();

const permissionField = $('#ppom_permission_mfields');

$(document).ready(function(){
if( permissionField.val().length === 0 ) {
permissionField.val(['administrator']);
permissionField.trigger('change');
}

permissionField.on('select2:unselecting', function(e){
if( typeof e.params.args === 'undefined' ) {
return;
}

const element = $(e.params.args.data.element);
if( element.prop('value') === 'administrator' ) {
alert(nmsf_vars.administrator_role_cannot_be_removed);
e.preventDefault();
}
});
});
});
3 changes: 2 additions & 1 deletion backend/settings-panel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,8 @@ public function set_localize_data( $handle, $var_name, $js_vars = array(), $glob
case 'nmsf-settings-panel':

$localize_data = [
'migrate_back_msg' => __( 'Are you sure?', $this->get_config( 'ppom' ) )
'migrate_back_msg' => __( 'Are you sure?', $this->get_config( 'ppom' ) ),
'administrator_role_cannot_be_removed' => esc_html__( 'The administrator role cannot be removed.', $this->get_config( 'ppom' ) )
];

break;
Expand Down
9 changes: 6 additions & 3 deletions classes/admin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function product_meta() {
$view = ( isset( $_REQUEST ['view'] ) ? sanitize_text_field( $_REQUEST ['view'] ) : '' );

if ( $action != 'new' && $do_meta != 'edit' && $do_meta != 'clone' && $view != 'addons' ) {
echo '<h1 class="ppom-heading-style">' . __( 'N-Media WooCommerce Personalized Product Option Manager', "ppom" ) . '</h1>';
echo '<h1 class="ppom-heading-style">' . __( 'Themeisle WooCommerce Personalized Product Fields Manager', "ppom" ) . '</h1>';
echo '<p>' . __( 'Create different meta groups for different products.', "ppom" ) . '</p>';
}

Expand All @@ -139,10 +139,12 @@ function product_meta() {
} elseif ( isset( $_REQUEST ['do_meta'] ) && $_REQUEST ['do_meta'] == 'clone' ) {

$this->clone_product_meta( intval( $_REQUEST ['productmeta_id'] ) );
// } else if ( isset ( $_REQUEST ['page'] ) && $_REQUEST ['page'] == 'ppom' && $view === 'addons' ) {
// ppom_load_template( 'admin/addons-list.php' );
} else if ( isset ( $_REQUEST ['page'] ) && $_REQUEST ['page'] == 'ppom' && $view === 'addons' ) {

ppom_load_template( 'admin/addons-list.php' );
} else {
$url_add = add_query_arg( array( 'action' => 'new' ) );
$addons = add_query_arg( array( 'view' => 'addons' ) );
// $video_url = 'https://najeebmedia.com/ppom/#howtovideo';
$ppom_settings_url = admin_url( "admin.php?page=wc-settings&tab=ppom_settings" );

Expand All @@ -151,6 +153,7 @@ function product_meta() {
// printf( __( '<p><a href="%s" target="_blank">Watch a Quick Video</a>', "ppom" ), $video_url );
printf( __( '<a href="%s">PPOM Settings</a></p>', "ppom" ), $ppom_settings_url );
echo '<a style="margin-right: 3px;" class="btn btn-success" href="' . esc_url( $url_add ) . '"><span class="dashicons dashicons-plus"></span> ' . __( 'Add PPOM Meta Group', "ppom" ) . '</a>';
echo '<a style="margin-right: 3px;" class="btn btn-success" href="' . esc_url( $addons ) . '"><span class="dashicons dashicons-plus"></span> ' . __( 'All Addons', "ppom" ) . '</a>';
echo '</div>';
echo '<br>';

Expand Down
4 changes: 2 additions & 2 deletions classes/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,8 @@ function show_wc_custom_message() {
function ppom_export_meta() {

// if( ppom_pro_is_installed() ) return '';
$buy_pro = 'https://themeisle.com/plugins/ppom-pro#pricing';
$args = array( "link_url" => $buy_pro, "link_text" => 'Buy $30.00', 'back_link' => true );
$buy_pro = tsdk_utmify( 'https://themeisle.com/plugins/ppom-pro/upgrade', 'export-import', 'tryexport' );
$args = array( "link_url" => $buy_pro, "link_text" => 'Buy now', 'back_link' => true );
wp_die( "Update to PRO Version for Export/Import", "Update to PRO", $args );
}

Expand Down
2 changes: 1 addition & 1 deletion classes/ppom.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function get_fields() {
}

// Filter fields which are active only
$meta_fields = array_filter( $meta_fields, function ( $field ) {
$meta_fields = array_filter( (array) $meta_fields, function ( $field ) {
return ! isset( $field['status'] ) || $field['status'] == 'on';
} );

Expand Down
12 changes: 6 additions & 6 deletions composer.lock

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

6 changes: 6 additions & 0 deletions grunt/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ module.exports = {
},
src: ['woocommerce-product-addon.php'],
},
readmetxt: {
options: {
prefix: 'Stable tag: ',
},
src: ['readme.txt'],
},
entryHeader: {
options: {
prefix: 'Version\\:.*\\s',
Expand Down
12 changes: 5 additions & 7 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function ppom_admin_save_form_meta() {
$enable_ajax_validation = "";

$ppom_meta = isset( $_REQUEST['ppom_meta'] ) ? $_REQUEST['ppom_meta'] : $_REQUEST['ppom'];
$product_meta = apply_filters( 'ppom_meta_data_saving', $ppom_meta, $productmeta_id );
$product_meta = apply_filters( 'ppom_meta_data_saving', (array)$ppom_meta, $productmeta_id );
$product_meta = ppom_sanitize_array_data( $product_meta );
$product_meta = json_encode( $product_meta );

Expand Down Expand Up @@ -262,7 +262,7 @@ function ppom_admin_save_form_meta() {

$ppom_id = $wpdb->insert_id;

$product_meta = apply_filters( 'ppom_meta_data_saving', $ppom, $ppom_id );
$product_meta = apply_filters( 'ppom_meta_data_saving', (array)$ppom, $ppom_id );
// Updating PPOM Meta with ppom_id in each meta array
ppom_admin_update_ppom_meta_only( $ppom_id, $product_meta );

Expand Down Expand Up @@ -342,7 +342,7 @@ function ppom_admin_update_form_meta() {
global $wpdb;

$ppom_meta = isset( $_REQUEST['ppom_meta'] ) ? $_REQUEST['ppom_meta'] : $_REQUEST['ppom'];
$product_meta = apply_filters( 'ppom_meta_data_saving', $ppom_meta, $productmeta_id );
$product_meta = apply_filters( 'ppom_meta_data_saving', (array)$ppom_meta, $productmeta_id );
$product_meta = ppom_sanitize_array_data( $product_meta );
$product_meta = json_encode( $product_meta );
// ppom_pa($product_meta); exit;
Expand Down Expand Up @@ -653,11 +653,9 @@ function ppom_admin_bar_menu() {

function ppom_admin_update_pro_notice() {

$ppom_url = 'https://themeisle.com/plugins/ppom-pro';
$buy_paddle = 'https://themeisle.com/plugins/ppom-pro#pricing';
$buy_paddle = tsdk_utmify( 'https://themeisle.com/plugins/ppom-pro/upgrade/', 'addmorefields', 'ppompage' );

echo '<div class="ppom-more-plugins-block">';
echo '<a class="btn btn-primary ppom-nm-plugins" href="' . esc_url( $buy_paddle ) . '">' . __( 'Buy PPOM PRO', 'ppom' ) . '</a>';
echo '<a class="btn btn-yellow ppom-nm-plugins" href="' . esc_url( $ppom_url ) . '">' . __( 'PPOM PRO Features & Demo', 'ppom' ) . '</a>';
echo '<a class="btn btn-primary ppom-nm-plugins" href="' . esc_url( $buy_paddle ) . '">' . __( 'Add more field types', 'ppom' ) . '</a>';
echo '</div>';
}
Loading