From 2e1d59f081e33239277a757c5fff43f8ab984d45 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 14 Aug 2024 18:57:41 +0200 Subject: [PATCH] v 0.12.0 - Moved all form related functions to a distinct file. - Ensure every field is correct. - Handle field type select. --- README.md | 2 +- inc/form.php | 275 +++++++++++++++++++++++++++++++ inc/helpers.php | 67 -------- inc/user.php | 178 +------------------- lang/wpu_extranet-fr_FR.l10n.php | 2 +- lang/wpu_extranet-fr_FR.mo | Bin 4405 -> 4597 bytes lang/wpu_extranet-fr_FR.po | 88 +++++----- wpu_extranet.php | 5 +- 8 files changed, 330 insertions(+), 287 deletions(-) create mode 100644 inc/form.php diff --git a/README.md b/README.md index 70b277d..7b347ac 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ $form_fields = array( 'label' => __('Subscribe to the newsletter', 'wpu_extranet') ) ); -$html_return_form = wpu_extranet__user__save_fields($form_fields, $form_infos); +$html_return_form = wpu_extranet__save_fields($form_fields, $form_infos); $form_settings = array( 'before_fields' => $html_return_form, 'form_action' => get_permalink() . '#' . $form_infos['form_id'], diff --git a/inc/form.php b/inc/form.php new file mode 100644 index 0000000..a33fd82 --- /dev/null +++ b/inc/form.php @@ -0,0 +1,275 @@ + '', + 'after_fields' => '', + 'hidden_fields' => array(), + 'has_honey_pot' => false, + 'load_user_values' => false, + 'allow_no_fields' => false, + 'form_action' => '', + 'form_title' => '', + 'form_submit' => __('Submit', 'wpu_extranet') + ); + $args = array_merge($defaults, $args); + if (!is_array($args['hidden_fields'])) { + $args['hidden_fields'] = array(); + } + + $form_attributes = ''; + foreach ($fields as $field_id => $field) { + if (isset($field['type']) && $field['type'] == 'file') { + $form_attributes .= ' enctype="multipart/form-data"'; + } + } + + $settings = wpu_extranet_get_skin_settings(); + $html = ''; + + $html .= '
'; + if ($args['form_title']) { + $html .= '

' . $args['form_title'] . '

'; + } + $html .= '
'; + $html .= $args['before_fields']; + $html .= '
    '; + foreach ($fields as $field_id => $field) { + if ($args['load_user_values']) { + $field['value'] = get_user_meta(get_current_user_id(), $field_id, true); + } + $html .= wpu_extranet__display_field($field_id, $field); + } + $html .= $args['after_fields']; + + if (!empty($fields) || $args['allow_no_fields']) { + $html .= '
  • '; + if ($args['has_honey_pot']) { + $honeypot_id = wpu_extranet_register_get_honeypot_id(); + $html .= ''; + } + $html .= wp_nonce_field('wpuextranet_' . $form_id . '_action', 'wpuextranet_' . $form_id, true, false); + foreach ($args['hidden_fields'] as $id => $value) { + $html .= ''; + } + $html .= ''; + $html .= '
  • '; + } + $html .= '
'; + $html .= '
'; + $html .= '
'; + + return $html; + +} + +/* Ensure field is correct +-------------------------- */ + +function wpu_extranet__correct_field($field, $field_id) { + if (!is_array($field)) { + $field = array(); + } + $defaults = array( + 'label' => $field_id, + 'required' => false, + 'readonly' => false, + 'value' => '', + 'options' => array(), + 'attributes' => '', + 'type' => 'text', + 'before_content' => '', + 'after_content' => '', + 'grid_start' => false, + 'grid_end' => false + ); + $field = array_merge($defaults, $field); + if (!isset($field['options']) || !is_array($field['options'])) { + $field['options'] = array(); + } + return $field; +} + +/* Display field +-------------------------- */ + +function wpu_extranet__display_field($field_id, $field) { + $html = ''; + + $field = wpu_extranet__correct_field($field, $field_id); + + if ($field['readonly']) { + $field['attributes'] .= ' readonly="readonly"'; + } + if ($field['required']) { + $field['attributes'] .= ' required="required"'; + } + + $field = apply_filters('wpu_extranet__display_field__field', $field, $field_id); + $settings = wpu_extranet_get_skin_settings(); + if ($field['grid_start']) { + $html .= '
  • '; + } + return $html; +} + +/* ---------------------------------------------------------- + Submit +---------------------------------------------------------- */ + +/* Update fields +-------------------------- */ + +function wpu_extranet__save_fields($fields, $args = array()) { + if (empty($_POST) || !is_array($fields)) { + return false; + } + $defaults = array( + 'form_id' => 'editmetas', + 'user_id' => get_current_user_id(), + 'callback_before_fields' => false, + 'callback_after_fields' => false + ); + $args = wp_parse_args($args, $defaults); + $errors = array(); + $fields = apply_filters('wpu_extranet__save_fields', $fields, $args); + + if ($args['callback_before_fields']) { + $errors = call_user_func($args['callback_before_fields'], $errors, $args); + } + + /* @TODO nonce */ + foreach ($fields as $field_id => $field) { + $check_field_id = $field_id; + $field = wpu_extranet__correct_field($field, $field_id); + $value = false; + if (isset($_POST[$field_id])) { + $value = $_POST[$field_id]; + } + if (isset($field['readonly']) && $field['readonly']) { + continue; + } + if ($field['type'] == 'checkbox') { + $value = isset($_POST[$field_id]) ? $_POST[$field_id] : '0'; + } + if ($field['type'] == 'multi-checkbox') { + $value = array(); + foreach ($field['options'] as $option_id => $option) { + if (isset($_POST[$field_id]) && in_array($option_id, $_POST[$field_id])) { + $value[] = $option_id; + } + } + $value = implode(';', $value); + } + if (isset($field['required']) && $field['required'] && empty($value)) { + $errors[] = sprintf(__('The field %s is required.', 'wpu_extranet'), $field['label']); + continue; + } + + if ($value === false) { + continue; + } + + $value = sanitize_text_field($value); + + /* Conditions */ + if (isset($field['minlength']) && strlen($value) < $field['minlength']) { + $errors[] = sprintf(__('The field %s must be at least %s characters.', 'wpu_extranet'), $field['label'], $field['minlength']); + continue; + } + if (isset($field['maxlength']) && strlen($value) > $field['maxlength']) { + $errors[] = sprintf(__('The field %s must be at most %s characters.', 'wpu_extranet'), $field['label'], $field['maxlength']); + continue; + } + + /* Types */ + if ($field['type'] == 'email' && !is_email($value)) { + $errors[] = sprintf(__('The field %s must be a valid email.', 'wpu_extranet'), $field['label']); + continue; + } + if ($field['type'] == 'url' && !filter_var($value, FILTER_VALIDATE_URL)) { + $errors[] = sprintf(__('The field %s must be a valid URL.', 'wpu_extranet'), $field['label']); + continue; + } + if ($field['type'] == 'select' && !isset($field['options'][$value])) { + $errors[] = sprintf(__('The field %s must be a valid option.', 'wpu_extranet'), $field['label']); + continue; + } + + if (!empty($errors)) { + break; + } + update_user_meta($args['user_id'], $field_id, $value); + } + + if ($args['callback_after_fields']) { + $errors = call_user_func($args['callback_after_fields'], $errors, $args); + } + + $return_type = 'error'; + if (empty($errors)) { + $return_type = 'success'; + $errors[] = __('Fields successfully updated!', 'wpu_extranet'); + } + return wpuextranet_get_html_errors($errors, array( + 'form_id' => $args['form_id'], + 'type' => $return_type + )); +} diff --git a/inc/helpers.php b/inc/helpers.php index 574c437..4ffccde 100644 --- a/inc/helpers.php +++ b/inc/helpers.php @@ -1,73 +1,6 @@ '', - 'after_fields' => '', - 'hidden_fields' => array(), - 'has_honey_pot' => false, - 'load_user_values' => false, - 'allow_no_fields' => false, - 'form_action' => '', - 'form_title' => '', - 'form_submit' => __('Submit', 'wpu_extranet') - ); - $args = array_merge($defaults, $args); - if (!is_array($args['hidden_fields'])) { - $args['hidden_fields'] = array(); - } - - $form_attributes = ''; - foreach ($fields as $field_id => $field) { - if (isset($field['type']) && $field['type'] == 'file') { - $form_attributes .= ' enctype="multipart/form-data"'; - } - } - - $settings = wpu_extranet_get_skin_settings(); - $html = ''; - - $html .= '
    '; - if ($args['form_title']) { - $html .= '

    ' . $args['form_title'] . '

    '; - } - $html .= '
    '; - $html .= $args['before_fields']; - $html .= '
      '; - foreach ($fields as $field_id => $field) { - if ($args['load_user_values']) { - $field['value'] = get_user_meta(get_current_user_id(), $field_id, true); - } - $html .= wpu_extranet__display_field($field_id, $field); - } - $html .= $args['after_fields']; - - if (!empty($fields) || $args['allow_no_fields']) { - $html .= '
    • '; - if ($args['has_honey_pot']) { - $honeypot_id = wpu_extranet_register_get_honeypot_id(); - $html .= ''; - } - $html .= wp_nonce_field('wpuextranet_' . $form_id . '_action', 'wpuextranet_' . $form_id, true, false); - foreach ($args['hidden_fields'] as $id => $value) { - $html .= ''; - } - $html .= ''; - $html .= '
    • '; - } - $html .= '
    '; - $html .= '
    '; - $html .= '
    '; - - return $html; - -} - /* ---------------------------------------------------------- Error messages ---------------------------------------------------------- */ diff --git a/inc/user.php b/inc/user.php index 7815bb9..f7e7caf 100644 --- a/inc/user.php +++ b/inc/user.php @@ -26,14 +26,7 @@ function wpu_extranet__user_register_fields() { } $fields = array(); foreach ($fields_raw as $key => $field) { - if (!isset($field['type'])) { - $field['type'] = 'text'; - } - - if (!isset($field['attributes'])) { - $field['attributes'] = ''; - } - + $field = wpu_extranet__correct_field($field, $key); if (!isset($field['in_registration_form'])) { $field['in_registration_form'] = true; } @@ -46,87 +39,6 @@ function wpu_extranet__user_register_fields() { } return $fields; } - -/* ---------------------------------------------------------- - Display field ----------------------------------------------------------- */ - -function wpu_extranet__display_field($field_id, $field) { - $html = ''; - $defaults = array( - 'label' => $field_id, - 'required' => false, - 'readonly' => false, - 'value' => '', - 'options' => array(), - 'attributes' => '', - 'type' => 'text', - 'before_content' => '', - 'after_content' => '', - 'grid_start' => false, - 'grid_end' => false - ); - $field = array_merge($defaults, $field); - if (!isset($field['options']) || !is_array($field['options'])) { - $field['options'] = array(); - } - if ($field['readonly']) { - $field['attributes'] .= ' readonly="readonly"'; - } - if ($field['required']) { - $field['attributes'] .= ' required="required"'; - } - - $field = apply_filters('wpu_extranet__display_field__field', $field, $field_id); - $settings = wpu_extranet_get_skin_settings(); - if ($field['grid_start']) { - $html .= '
  • '; - } - return $html; -} - /* ---------------------------------------------------------- Log user by id ---------------------------------------------------------- */ @@ -169,91 +81,3 @@ function wpu_extranet_log_user($user) { return $avatar_url; }, 1, 3); - -/* ---------------------------------------------------------- - Update fields ----------------------------------------------------------- */ - -function wpu_extranet__user__save_fields($fields, $args = array()) { - if (empty($_POST) || !is_array($fields)) { - return false; - } - $defaults = array( - 'form_id' => 'editmetas', - 'user_id' => get_current_user_id(), - 'callback_before_fields' => false, - 'callback_after_fields' => false - ); - $args = wp_parse_args($args, $defaults); - $errors = array(); - $fields = apply_filters('wpu_extranet__user__save_fields', $fields, $args); - - if ($args['callback_before_fields']) { - $errors = call_user_func($args['callback_before_fields'], $errors, $args); - } - - /* @TODO nonce */ - foreach ($fields as $field_id => $field) { - $check_field_id = $field_id; - $value = false; - if (isset($_POST[$field_id])) { - $value = $_POST[$field_id]; - } - if (isset($field['readonly']) && $field['readonly']) { - continue; - } - if ($field['type'] == 'checkbox') { - $value = isset($_POST[$field_id]) ? $_POST[$field_id] : '0'; - } - if ($field['type'] == 'multi-checkbox') { - $value = array(); - foreach ($field['options'] as $option_id => $option) { - if (isset($_POST[$field_id]) && in_array($option_id, $_POST[$field_id])) { - $value[] = $option_id; - } - } - $value = implode(';', $value); - } - if (isset($field['required']) && $field['required'] && empty($value)) { - $errors[] = sprintf(__('The field %s is required.', 'wpu_extranet'), $field['label']); - continue; - } - - if ($value === false) { - continue; - } - - $value = sanitize_text_field($value); - if (isset($field['minlength']) && strlen($value) < $field['minlength']) { - $errors[] = sprintf(__('The field %s must be at least %s characters.', 'wpu_extranet'), $field['label'], $field['minlength']); - continue; - } - if (isset($field['maxlength']) && strlen($value) > $field['maxlength']) { - $errors[] = sprintf(__('The field %s must be at most %s characters.', 'wpu_extranet'), $field['label'], $field['maxlength']); - continue; - } - if (isset($field['type']) && $field['type'] == 'email' && !is_email($value)) { - $errors[] = sprintf(__('The field %s must be a valid email.', 'wpu_extranet'), $field['label']); - continue; - } - - if (!empty($errors)) { - break; - } - update_user_meta($args['user_id'], $field_id, $value); - } - - if ($args['callback_after_fields']) { - $errors = call_user_func($args['callback_after_fields'], $errors, $args); - } - - $return_type = 'error'; - if (empty($errors)) { - $return_type = 'success'; - $errors[] = __('Fields successfully updated!', 'wpu_extranet'); - } - return wpuextranet_get_html_errors($errors, array( - 'form_id' => $args['form_id'], - 'type' => $return_type - )); -} diff --git a/lang/wpu_extranet-fr_FR.l10n.php b/lang/wpu_extranet-fr_FR.l10n.php index d35c9e3..d89f39c 100644 --- a/lang/wpu_extranet-fr_FR.l10n.php +++ b/lang/wpu_extranet-fr_FR.l10n.php @@ -1,2 +1,2 @@ NULL,'plural-forms'=>NULL,'messages'=>['Submit'=>'Envoyer','Error:'=>'Erreur :','All fields are required.'=>'Tous les champs sont requis.','Invalid email.'=>'E-mail invalide.','New email is the same as the current email.'=>'Le nouvel e-mail est le même que l’e-mail actuel.','Emails do not match.'=>'Les e-mails ne sont pas identiques.','Email is already in use.'=>'L’e-mail est déjà utilisé.','Email successfully updated!'=>'L’e-mail a été mis à jour avec succès !','Your current email'=>'Votre adresse e-mail actuelle','New email'=>'Nouvel e-mail','Confirm new email'=>'Confirmez votre nouvel e-mail','Change email'=>'Changer d\'adresse e-mail','Current password is incorrect.'=>'Le mot de passe actuel est incorrect.','Passwords do not match.'=>'Les mots de passe ne correspondent pas.','Password is too short, minimum of 6 characters.'=>'Le mot de passe est trop court, minimum de 6 caractères.','Password successfully changed!'=>'Mot de passe changé avec succès !','Enter your current password'=>'Veuillez saisir votre mot de passe actuel','New password'=>'Nouveau mot de passe','Confirm new password'=>'Confirmer le nouveau mot de passe','Change password'=>'Changer le mot de passe','You can not delete this type of account.'=>'Vous ne pouvez pas supprimer ce type de compte.','Invalid password.'=>'Mot de passe invalide.','Delete your account'=>'Supprimer votre compte','Profile successfully updated!'=>'Profil mis à jour avec succès!','Infos'=>'Infos','The current avatar is generated by %s.'=>'L’avatar actuel est généré par %s.','Delete this avatar'=>'Supprimer cet avatar','Avatar'=>'Avatar','Username'=>'Nom d\'utilisateur','Email'=>'E-mail','Edit my infos'=>'Modifier mes infos','Check your email for the confirmation link.'=>'Vérifiez vos courriels pour y trouver le lien de confirmation.','Your account could not be found.'=>'Votre compte est introuvable.','Reset password failed.'=>'Échec de la réinitialisation du mot de passe.','Username or Email Address'=>'Identifiant ou adresse email','Get New Password'=>'Obtenir un nouveau mot de passe','Registration confirmation will be emailed to you.'=>'La confirmation d’inscription vous sera envoyée par courriel.','This username already exists.'=>'Ce nom d’utilisateur existe déjà.','This email is already registered.'=>'Cet e-mail est déjà enregistré.','This username contains invalid characters.'=>'Ce nom d’utilisateur contient des caractères non valides.','Registration failed.'=>'Échec de l’inscription.','Password'=>'Mot de passe','Register'=>'S\'inscrire','Log out'=>'Se déconnecter','First name'=>'Prénom','Last name'=>'Nom','The field %s is required.'=>'Le champ %s est obligatoire.','The field %s must be at least %s characters.'=>'Le champ %s doit comporter au moins %s caractères.','The field %s must be at most %s characters.'=>'Le champ %s doit comporter au maximum %s caractères.','The field %s must be a valid email.'=>'Le champ %s doit être un e-mail valide.','Fields successfully updated!'=>'Champs mis à jour avec succès !','Simple toolbox to create an extranet or a customer account'=>'Boîte à outils simple pour créer un extranet ou un compte client'],'language'=>'fr_FR','x-generator'=>'Poedit 3.4.4']; \ No newline at end of file +return ['domain'=>NULL,'plural-forms'=>NULL,'messages'=>['Submit'=>'Envoyer','The field %s is required.'=>'Le champ %s est obligatoire.','The field %s must be at least %s characters.'=>'Le champ %s doit comporter au moins %s caractères.','The field %s must be at most %s characters.'=>'Le champ %s doit comporter au maximum %s caractères.','The field %s must be a valid email.'=>'Le champ %s doit être un e-mail valide.','The field %s must be a valid URL.'=>'Le champ %s doit être une URL valide.','The field %s must be a valid option.'=>'Le champ %s doit être une option valide.','Fields successfully updated!'=>'Champs mis à jour avec succès !','Error:'=>'Erreur :','All fields are required.'=>'Tous les champs sont requis.','Invalid email.'=>'E-mail invalide.','New email is the same as the current email.'=>'Le nouvel e-mail est le même que l’e-mail actuel.','Emails do not match.'=>'Les e-mails ne sont pas identiques.','Email is already in use.'=>'L’e-mail est déjà utilisé.','Email successfully updated!'=>'L’e-mail a été mis à jour avec succès !','Your current email'=>'Votre adresse e-mail actuelle','New email'=>'Nouvel e-mail','Confirm new email'=>'Confirmez votre nouvel e-mail','Change email'=>'Changer d\'adresse e-mail','Current password is incorrect.'=>'Le mot de passe actuel est incorrect.','Passwords do not match.'=>'Les mots de passe ne correspondent pas.','Password is too short, minimum of 6 characters.'=>'Le mot de passe est trop court, minimum de 6 caractères.','Password successfully changed!'=>'Mot de passe changé avec succès !','Enter your current password'=>'Veuillez saisir votre mot de passe actuel','New password'=>'Nouveau mot de passe','Confirm new password'=>'Confirmer le nouveau mot de passe','Change password'=>'Changer le mot de passe','You can not delete this type of account.'=>'Vous ne pouvez pas supprimer ce type de compte.','Invalid password.'=>'Mot de passe invalide.','Delete your account'=>'Supprimer votre compte','Profile successfully updated!'=>'Profil mis à jour avec succès!','The current avatar is generated by %s.'=>'L’avatar actuel est généré par %s.','Delete this avatar'=>'Supprimer cet avatar','Avatar'=>'Avatar','Username'=>'Nom d\'utilisateur','Email'=>'E-mail','Edit my infos'=>'Modifier mes infos','Infos'=>'Infos','Check your email for the confirmation link.'=>'Vérifiez vos courriels pour y trouver le lien de confirmation.','Your account could not be found.'=>'Votre compte est introuvable.','Reset password failed.'=>'Échec de la réinitialisation du mot de passe.','Username or Email Address'=>'Identifiant ou adresse email','Get New Password'=>'Obtenir un nouveau mot de passe','Registration confirmation will be emailed to you.'=>'La confirmation d’inscription vous sera envoyée par courriel.','This username already exists.'=>'Ce nom d’utilisateur existe déjà.','This email is already registered.'=>'Cet e-mail est déjà enregistré.','This username contains invalid characters.'=>'Ce nom d’utilisateur contient des caractères non valides.','Registration failed.'=>'Échec de l’inscription.','Password'=>'Mot de passe','Register'=>'S\'inscrire','Log out'=>'Se déconnecter','First name'=>'Prénom','Last name'=>'Nom','Simple toolbox to create an extranet or a customer account'=>'Boîte à outils simple pour créer un extranet ou un compte client'],'language'=>'fr_FR','x-generator'=>'Poedit 3.4.4']; \ No newline at end of file diff --git a/lang/wpu_extranet-fr_FR.mo b/lang/wpu_extranet-fr_FR.mo index 6a6e35ea0681bbeef84c0a0fa23510d55386b428..749712676fa95281c23a44b6456afd81bcb01b0b 100644 GIT binary patch delta 1283 zcmY+^Pe>GD7{~E<+cl?h8?!ZSH*IuR%iL|(%EAaz3PSWG{UJM4up3$a!>ofHCa9F6 zOKqM6Ng@jCuw@;BIt39zkSNq?PjxIh^oKyG?{D0oUiN)IGsDch&-*;@?6cbMQ8!-} z7&o+C^bPa{pE2!t!_Pp=1&pc0$G9A4u>|MP#ymFS7hHqkB4a`r$7*cDGCYB6@f-$m z4EeccoKX`@U<99{UhuAP{s}d)k3j)ixDxBI6jR78rVUr)0aPG|aRr{nVjL=*kDvm+ zf+fsvavWG(c!^1Tjf(sSR$w_#S78EmUk5hfK~$ilxDF?9H$FigHJ`B_zu|g}@Nf+_ zV-$~IjQPz)4&rzR71>+VjlWP6M_9%dY(XxWH0p(YxEaUL!5k{pbC{-#A5j@=U$qp_ zDO9HWPzxJHcP|H%9B86EYT`w#!)gkx74Ao^@F;46LDUK_<3_xW37kf)>;pF7A`*kC zr{H>T3Q30PLOs_VB>$@22p3e#OQ?x%qW0ed)Fyj`{LBl69XN{$>^Cxp2~qeKtU(2E z3^$>R4&F!YnK#&q^BBgEP5xE$B(vEWS_bG|?G_ns;H Gw(k#IT5)9n delta 1198 zcmZA1Pe{{Y9LMqRa^_OEe%f?SGv`)TI-QoGmXXpyD7@$?Dg)UiP&`=Y;Y~$B7+yMb z5C#^8(8x|ffdxf$>re*~y!8hnk?@fC{yf_udf4-O{r2y9zR%}*w!OrQcxJ2GzihNi z^po^WpV<&jlyITV`pxQa4v*prR^k&pjvLs9@30DgV;KFVW~VTU)!2(C@FoWF9`eZ8 zBv(x^jSaYf8ep~f{1s~AFQ@{yu^j)RhXLN?)}k1~CR8CEcnk-y3~v;lkDv;^gO$v0 zv)lxDVHs2S7*+WvjNngf#8O7l=Mvb3NmQX@Sc}tm8RwC&*jsGDj~K;WOkj{flGuf9 z%x`1dG~+yKqBU&A56HvzxM+X_Jco5GD~5xpXvZKXQ0o(BkYDM?)JT4+N*h|#7Z;(aX4(fZ~ zQCn5P0npY}1<79%#d$&Jtq*mmt|AW`=F*L~QH3obV^|LR@Hwi0A9xl$4nPchkwx1r z9KbZzV-B^&ukkwm3X#7m>}FOC(2t5Rjf#2(FXB_wFJuej7^ZwB)`R_c7j@_!p}xO{ zDSVHLdcSCd53y4&1uabH&+QQlaHp~zYv`SH4WRf>)74_`TDYhfYH=|u!6aR0L`_kv zDH(Rq6{hW@26vuxcrVb^GFqh~{kLfk6`!_5)hn6*n^IHLPgYx_ldgzK){fA1;FO%2 xl2U5?HMn0Exc`FI!p94d=>T=)pZRko*$08f{6=83EZgZdXV<+@e$Jcl9RglmTVntK diff --git a/lang/wpu_extranet-fr_FR.po b/lang/wpu_extranet-fr_FR.po index e38cb7b..afb2df8 100644 --- a/lang/wpu_extranet-fr_FR.po +++ b/lang/wpu_extranet-fr_FR.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: WPU Extranet\n" -"POT-Creation-Date: 2024-08-09 17:26+0200\n" +"POT-Creation-Date: 2024-08-14 18:55+0200\n" "PO-Revision-Date: \n" "Last-Translator: Darklg \n" "Language-Team: \n" @@ -15,11 +15,45 @@ msgstr "" "X-Poedit-KeywordsList: __;_e\n" "X-Poedit-SearchPath-0: ../.\n" -#: .././inc/helpers.php:17 +#: .././inc/form.php:20 msgid "Submit" msgstr "Envoyer" -#: .././inc/helpers.php:84 +#: .././inc/form.php:221 +#, php-format +msgid "The field %s is required." +msgstr "Le champ %s est obligatoire." + +#: .././inc/form.php:233 +#, php-format +msgid "The field %s must be at least %s characters." +msgstr "Le champ %s doit comporter au moins %s caractères." + +#: .././inc/form.php:237 +#, php-format +msgid "The field %s must be at most %s characters." +msgstr "Le champ %s doit comporter au maximum %s caractères." + +#: .././inc/form.php:243 +#, php-format +msgid "The field %s must be a valid email." +msgstr "Le champ %s doit être un e-mail valide." + +#: .././inc/form.php:247 +#, php-format +msgid "The field %s must be a valid URL." +msgstr "Le champ %s doit être une URL valide." + +#: .././inc/form.php:251 +#, php-format +msgid "The field %s must be a valid option." +msgstr "Le champ %s doit être une option valide." + +#: .././inc/form.php:268 +msgid "Fields successfully updated!" +msgstr "Champs mis à jour avec succès !" + +#: .././inc/helpers.php:26 msgid "Error:" msgstr "Erreur :" @@ -115,35 +149,35 @@ msgstr "Supprimer votre compte" msgid "Profile successfully updated!" msgstr "Profil mis à jour avec succès!" -#: .././inc/modules/edit-metas.php:120 -msgid "Infos" -msgstr "Infos" - -#: .././inc/modules/edit-metas.php:143 +#: .././inc/modules/edit-metas.php:136 #, php-format msgid "The current avatar is generated by %s." msgstr "L’avatar actuel est généré par %s." -#: .././inc/modules/edit-metas.php:146 +#: .././inc/modules/edit-metas.php:139 msgid "Delete this avatar" msgstr "Supprimer cet avatar" -#: .././inc/modules/edit-metas.php:149 +#: .././inc/modules/edit-metas.php:144 msgid "Avatar" msgstr "Avatar" -#: .././inc/modules/edit-metas.php:159 .././inc/modules/register.php:150 +#: .././inc/modules/edit-metas.php:154 .././inc/modules/register.php:150 msgid "Username" msgstr "Nom d'utilisateur" -#: .././inc/modules/edit-metas.php:164 .././inc/modules/register.php:156 +#: .././inc/modules/edit-metas.php:159 .././inc/modules/register.php:156 msgid "Email" msgstr "E-mail" -#: .././inc/modules/edit-metas.php:180 +#: .././inc/modules/edit-metas.php:177 msgid "Edit my infos" msgstr "Modifier mes infos" +#: .././inc/modules/edit-metas.php:178 +msgid "Infos" +msgstr "Infos" + #: .././inc/modules/lost-password.php:35 msgid "Check your email for the confirmation link." msgstr "Vérifiez vos courriels pour y trouver le lien de confirmation." @@ -192,7 +226,7 @@ msgstr "Mot de passe" msgid "Register" msgstr "S'inscrire" -#: .././inc/pages.php:91 +#: .././inc/pages.php:112 msgid "Log out" msgstr "Se déconnecter" @@ -204,31 +238,7 @@ msgstr "Prénom" msgid "Last name" msgstr "Nom" -#: .././inc/user.php:206 -#, php-format -msgid "The field %s is required." -msgstr "Le champ %s est obligatoire." - -#: .././inc/user.php:210 -#, php-format -msgid "The field %s must be at least %s characters." -msgstr "Le champ %s doit comporter au moins %s caractères." - -#: .././inc/user.php:214 -#, php-format -msgid "The field %s must be at most %s characters." -msgstr "Le champ %s doit comporter au maximum %s caractères." - -#: .././inc/user.php:218 -#, php-format -msgid "The field %s must be a valid email." -msgstr "Le champ %s doit être un e-mail valide." - -#: .././inc/user.php:231 -msgid "Fields successfully updated!" -msgstr "Champs mis à jour avec succès !" - -#: .././wpu_extranet.php:54 +#: .././wpu_extranet.php:55 msgid "Simple toolbox to create an extranet or a customer account" msgstr "Boîte à outils simple pour créer un extranet ou un compte client" diff --git a/wpu_extranet.php b/wpu_extranet.php index f927ae3..0251d6e 100644 --- a/wpu_extranet.php +++ b/wpu_extranet.php @@ -4,7 +4,7 @@ /* Plugin Name: WPU Extranet Description: Simple toolbox to create an extranet or a customer account -Version: 0.11.0 +Version: 0.12.0 Author: Darklg Author URI: https://darklg.me/ Text Domain: wpu_extranet @@ -18,7 +18,7 @@ Update URI: https://github.com/WordPressUtilities/wpu_extranet */ -define('WPU_EXTRANET_VERSION', '0.11.0'); +define('WPU_EXTRANET_VERSION', '0.12.0'); /* ---------------------------------------------------------- Settings @@ -29,6 +29,7 @@ require_once __DIR__ . '/inc/pages.php'; require_once __DIR__ . '/inc/permissions.php'; require_once __DIR__ . '/inc/user.php'; +require_once __DIR__ . '/inc/form.php'; /* ---------------------------------------------------------- Modules