Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: translation for password strength #1476

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions assets/js/frontend-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,19 +679,19 @@
errors.push({
type: 'custom',
container: item,
message: 'Password minimum strength should be weak'
message: wpuf_frontend.password_warning_weak
});
} else if (strength === 'medium' && strengthMeter < 3) {
errors.push({
type: 'custom',
container: item,
message: 'Password minimum strength should be medium'
message: wpuf_frontend.password_warning_medium
});
} else if (strength === 'strong' && strengthMeter < 4) {
errors.push({
type: 'custom',
container: item,
message: 'Password strength should be strong'
message: wpuf_frontend.password_warning_strong
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend-form.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions includes/Fields/Form_Field_Post_Taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ class Form_Field_Post_Taxonomy extends Field_Contract {

protected $form_id;

/**
* @var mixed|string
*/
private $exclude_type;

/**
* @var mixed
*/
private $exclude;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor Suggestion: Simplify render Method

The render method is quite complex and handles multiple scenarios. Consider refactoring it to improve readability and maintainability. Possible approaches could include breaking it down into smaller, more focused methods or using a strategy pattern for different field types.

public function __construct( $tax_name, $taxonomy, $post_id = null, $user_id = null ) {
//phpcs:ignore
$this->name = __( ucfirst( $tax_name ), 'wp-user-frontend' );
Expand Down
4 changes: 4 additions & 0 deletions includes/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
|| wpuf_has_shortcode( 'weforms' )
|| wpuf_has_shortcode( 'wpuf_account' )
|| wpuf_has_shortcode( 'wpuf_sub_pack' )
|| ( isset( $post->ID ) && ( $pay_page == $post->ID ) )

Check warning on line 54 in includes/Frontend.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Loose comparisons are not allowed. Expected: "==="; Found: "=="
|| isset( $_GET['wpuf_preview'] )

Check warning on line 55 in includes/Frontend.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
|| class_exists( '\Elementor\Plugin' )
|| $this->dokan_is_seller_dashboard() ) {
wp_enqueue_style( 'wpuf-layout1' );
Expand Down Expand Up @@ -135,7 +135,11 @@
'wp-user-frontend'
),
'protected_shortcodes' => wpuf_get_protected_shortcodes(),
// translators: %shortcode% is the shortcode name
'protected_shortcodes_message' => __( 'Using %shortcode% is restricted', 'wp-user-frontend' ),
'password_warning_weak' => __( 'Your password should be at least weak in strength', 'wp-user-frontend' ),
'password_warning_medium' => __( 'Your password needs to be medium strength for better protection', 'wp-user-frontend' ),
'password_warning_strong' => __( 'Create a strong password for maximum security', 'wp-user-frontend' ),
]
)
);
Expand Down Expand Up @@ -190,7 +194,7 @@
$current_user = wp_get_current_user();

if ( ! empty( $current_user->roles ) && ! empty( $current_user->roles[0] ) ) {
if ( ! in_array( $current_user->roles[0], $roles ) ) {

Check failure on line 197 in includes/Frontend.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Not using strict comparison for in_array; supply true for $strict argument.
return false;
}
}
Expand Down
43 changes: 28 additions & 15 deletions languages/wp-user-frontend.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WP User Frontend 4.0.10\n"
"Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
"POT-Creation-Date: 2024-08-22 03:44:53+00:00\n"
"POT-Creation-Date: 2024-09-05 05:07:35+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -1456,13 +1456,13 @@ msgstr ""
msgid "Strength indicator"
msgstr ""

#: class/render-form.php:1413 includes/Fields/Form_Field_Post_Taxonomy.php:134
#: includes/Fields/Form_Field_Post_Taxonomy.php:264
#: class/render-form.php:1413 includes/Fields/Form_Field_Post_Taxonomy.php:144
#: includes/Fields/Form_Field_Post_Taxonomy.php:274
#: includes/Render_Form.php:1270
msgid "-- Select --"
msgstr ""

#: class/render-form.php:1477 includes/Fields/Form_Field_Post_Taxonomy.php:73
#: class/render-form.php:1477 includes/Fields/Form_Field_Post_Taxonomy.php:83
#: includes/Render_Form.php:1334
msgid "This field is no longer available."
msgstr ""
Expand Down Expand Up @@ -2420,7 +2420,7 @@ msgstr ""
#: includes/Admin/Forms/Post/Templates/Post_Form_Template_Events_Calendar.php:185
msgid ""
"Event has been updated successfully. <a target=\"_blank\" "
"href=\"%link%\">View event</a>"
"href=\"{link}\">View event</a>"
msgstr ""

#: includes/Admin/Forms/Post/Templates/Post_Form_Template_Events_Calendar.php:188
Expand Down Expand Up @@ -2457,7 +2457,7 @@ msgstr ""
#: includes/Fields/Field_Contract.php:235
#: includes/Fields/Form_Field_Dropdown.php:108
#: includes/Fields/Form_Field_MultiDropdown.php:85
#: includes/Fields/Form_Field_Post_Taxonomy.php:461
#: includes/Fields/Form_Field_Post_Taxonomy.php:471
msgid "- select -"
msgstr ""

Expand Down Expand Up @@ -2489,7 +2489,7 @@ msgstr ""
#: includes/Admin/Forms/Post/Templates/Post_Form_Template_Post.php:151
msgid ""
"Post has been updated successfully. <a target=\"_blank\" "
"href=\"%link%\">View post</a>"
"href=\"{link}\">View post</a>"
msgstr ""

#: includes/Admin/Forms/Post/Templates/Post_Form_Template_Post.php:153
Expand Down Expand Up @@ -2649,15 +2649,15 @@ msgstr ""
msgid " Add Form"
msgstr ""

#: includes/Admin/Upgrades.php:121
#: includes/Admin/Upgrades.php:120
msgid "WPUF Data Update Required"
msgstr ""

#: includes/Admin/Upgrades.php:122
#: includes/Admin/Upgrades.php:121
msgid "Run the updater"
msgstr ""

#: includes/Admin/Upgrades.php:127
#: includes/Admin/Upgrades.php:126
msgid ""
"It is strongly recommended that you backup your database before proceeding. "
"Are you sure you wish to run the updater now?"
Expand Down Expand Up @@ -3118,7 +3118,7 @@ msgstr ""
msgid "Import"
msgstr ""

#: includes/Ajax/Address_Form_Ajax.php:40 includes/Frontend.php:154
#: includes/Ajax/Address_Form_Ajax.php:40 includes/Frontend.php:158
msgid "Some Required Fields are not filled!"
msgstr ""

Expand Down Expand Up @@ -4963,19 +4963,32 @@ msgid ""
"character."
msgstr ""

#: includes/Frontend.php:138
#: includes/Frontend.php:139
#. translators: %shortcode% is the shortcode name
msgid "Using %shortcode% is restricted"
msgstr ""

#: includes/Frontend.php:144
#: includes/Frontend.php:140
msgid "Password minimum strength should be weak"
msgstr ""

#: includes/Frontend.php:141
msgid "Password minimum strength should be medium"
msgstr ""

#: includes/Frontend.php:142
msgid "Password minimum strength should be strong"
msgstr ""

#: includes/Frontend.php:148
msgid "is required"
msgstr ""

#: includes/Frontend.php:145
#: includes/Frontend.php:149
msgid "does not match"
msgstr ""

#: includes/Frontend.php:146
#: includes/Frontend.php:150
msgid "is not valid"
msgstr ""

Expand Down
Loading