From b2bb2c13ebf53e5725104f194287a3b387779643 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Mon, 5 Apr 2021 19:06:44 +0300 Subject: [PATCH] - code formatting; - small changes for #790; --- includes/admin/assets/js/um-admin-field.js | 8 ++++---- includes/admin/core/class-admin-enqueue.php | 2 +- includes/core/class-access.php | 4 ++-- includes/core/class-fields.php | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/includes/admin/assets/js/um-admin-field.js b/includes/admin/assets/js/um-admin-field.js index b4702a68..3e9591a8 100644 --- a/includes/admin/assets/js/um-admin-field.js +++ b/includes/admin/assets/js/um-admin-field.js @@ -4,11 +4,11 @@ jQuery(document).ready(function() { jQuery(document.body).on('click', '.um-admin-btns a span.remove', function(e){ e.preventDefault(); - if ( confirm( 'This will permanently delete this custom field from a database and from all forms on your site. Are you sure?' ) ) { + if ( confirm( wp.i18n.__( 'This will permanently delete this custom field from a database and from all forms on your site. Are you sure?', 'ultimate-member' ) ) ) { jQuery(this).parents('a').remove(); - arg1 = jQuery(this).parents('a').data('arg1'); + var arg1 = jQuery(this).parents('a').data('arg1'); jQuery.ajax({ url: wp.ajax.settings.url, @@ -20,10 +20,10 @@ jQuery(document).ready(function() { nonce: um_admin_scripts.nonce }, - success: function(data){ + success: function(data) { jQuery('#um-admin-form-builder .' + arg1).remove(); }, - error: function(data){ + error: function(data) { } }); diff --git a/includes/admin/core/class-admin-enqueue.php b/includes/admin/core/class-admin-enqueue.php index b53f9fa5..d1a27aab 100644 --- a/includes/admin/core/class-admin-enqueue.php +++ b/includes/admin/core/class-admin-enqueue.php @@ -279,7 +279,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { * Field Processing */ function load_field() { - wp_register_script( 'um_admin_field', $this->js_url . 'um-admin-field.js', array('jquery', 'wp-util'), ultimatemember_version, true ); + wp_register_script( 'um_admin_field', $this->js_url . 'um-admin-field.js', array('jquery', 'wp-util', 'wp-i18n'), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_field' ); } diff --git a/includes/core/class-access.php b/includes/core/class-access.php index 2d9c2123..d1ad50b4 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -1043,7 +1043,7 @@ if ( ! class_exists( 'um\core\Access' ) ) { } return $content; } - + /** * Turn on the content replacement on the filter 'the_content' @@ -1054,7 +1054,7 @@ if ( ! class_exists( 'um\core\Access' ) ) { public function replace_post_content_on() { add_filter( 'the_content', array( $this, 'replace_post_content' ), 9999, 1 ); } - + /** * Turn off the content replacement on the filter 'the_content' diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index a0ce03ec..c4a05f35 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -256,14 +256,14 @@ if ( ! class_exists( 'um\core\Fields' ) ) { do_action( 'um_delete_custom_field', $id, $args ); update_option( 'um_fields', $fields ); - } - global $wpdb; - $forms = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'um_form'"); - foreach ( $forms as $form_id ) { - $form_fields = get_post_meta( $form_id, '_um_custom_fields', true ); - unset( $form_fields[ $id ] ); - update_post_meta( $form_id, '_um_custom_fields', $form_fields ); + global $wpdb; + $forms = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'um_form'" ); + foreach ( $forms as $form_id ) { + $form_fields = get_post_meta( $form_id, '_um_custom_fields', true ); + unset( $form_fields[ $id ] ); + update_post_meta( $form_id, '_um_custom_fields', $form_fields ); + } } }