PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / ShortcodeParser / Builder / EditProfileBuilder.php
wp-user-avatar / src / ShortcodeParser / Builder Last commit date
EditProfileBuilder.php 3 years ago FieldsShortcodeCallback.php 4 months ago FrontendProfileBuilder.php 10 months ago GlobalShortcodes.php 3 years ago LoginFormBuilder.php 2 years ago PasswordResetBuilder.php 1 month ago RegistrationFormBuilder.php 1 year ago index.php 5 years ago
EditProfileBuilder.php
190 lines
1 <?php
2
3 namespace ProfilePress\Core\ShortcodeParser\Builder;
4
5 use ProfilePress\Core\Classes\FormRepository;
6
7 class EditProfileBuilder
8 {
9 public function __construct()
10 {
11 $instance = new FieldsShortcodeCallback(FormRepository::EDIT_PROFILE_TYPE);
12
13 add_shortcode('edit-profile-username', array($instance, 'username'));
14
15 add_shortcode('edit-profile-password', array($instance, 'password'));
16
17 add_shortcode('edit-profile-confirm-password', array($instance, 'confirm_password'));
18
19 add_shortcode('edit-profile-password-meter', array(__CLASS__, 'password_meter'));
20
21 add_shortcode('edit-profile-email', array($instance, 'email'));
22
23 add_shortcode('edit-profile-confirm-email', array($instance, 'confirm_email'));
24
25 add_shortcode('edit-profile-website', array($instance, 'website'));
26
27 add_shortcode('edit-profile-nickname', array($instance, 'nickname'));
28
29 add_shortcode('edit-profile-display-name', array($instance, 'display_name'));
30
31 add_shortcode('edit-profile-first-name', array($instance, 'first_name'));
32
33 add_shortcode('edit-profile-last-name', array($instance, 'last_name'));
34
35 add_shortcode('edit-profile-bio', array($instance, 'bio'));
36
37 add_shortcode('delete-avatar-button', array($instance, 'remove_user_avatar'));
38 add_shortcode('pp-remove-avatar-button', array($instance, 'remove_user_avatar'));
39
40 add_shortcode('edit-profile-avatar', array($instance, 'avatar'));
41
42 add_shortcode('edit-profile-cover-image', array($instance, 'cover_image'));
43 add_shortcode('pp-remove-cover-image-button', array($instance, 'remove_cover_image'));
44
45 add_shortcode('edit-profile-cpf', array($instance, 'custom_profile_field'));
46
47 add_shortcode('edit-profile-submit', array($instance, 'submit'));
48
49 add_shortcode('edit-profile-text-box', array($instance, 'textbox_field'));
50 add_shortcode('edit-profile-textarea', array($instance, 'textarea_field'));
51 add_shortcode('edit-profile-select-dropdown', array($instance, 'select_dropdown_field'));
52 add_shortcode('edit-profile-checkbox-list', array($instance, 'checkbox_list_field'));
53 add_shortcode('edit-profile-single-checkbox', array($instance, 'single_checkbox_field'));
54 add_shortcode('edit-profile-cf-password', array($instance, 'cf_password_field'));
55 add_shortcode('edit-profile-country', array($instance, 'country_field'));
56 add_shortcode('edit-profile-date-field', array($instance, 'date_field'));
57 add_shortcode('edit-profile-number-field', array($instance, 'number_field'));
58 add_shortcode('edit-profile-radio-buttons', array($instance, 'radio_buttons_field'));
59
60 do_action('ppress_register_edit_profile_form_shortcode');
61 }
62
63 /**
64 * Password strength meter field.
65 */
66 public static function password_meter($atts)
67 {
68 // grab unofficial attributes
69 $other_atts_html = ppress_other_field_atts($atts);
70
71 $atts = shortcode_atts(
72 array(
73 'class' => '',
74 'enforce' => 'false',
75 ),
76 $atts
77 );
78
79 $atts = apply_filters('ppress_edit_profile_password_meter_field_atts', $atts);
80
81 if (isset($atts['enforce']) && in_array($atts['enforce'], ['1', 'true', true], true)) {
82 $atts['enforce'] = 'true';
83 }
84
85 wp_localize_script('password-strength-meter', 'pwsL10n', array(
86 'empty' => esc_html__('Strength indicator', 'wp-user-avatar'),
87 'short' => esc_html__('Very weak', 'wp-user-avatar'),
88 'bad' => esc_html__('Weak', 'wp-user-avatar'),
89 'good' => _x('Medium', 'password strength', 'wp-user-avatar'),
90 'strong' => esc_html__('Strong', 'wp-user-avatar'),
91 'mismatch' => esc_html__('Mismatch', 'wp-user-avatar'),
92 ));
93
94 ob_start(); ?>
95
96 <?php if ('true' == $atts['enforce']) : ?>
97 <input type="hidden" name="pp_enforce_password_meter" value="true">
98 <?php endif; ?>
99 <div id="pp-pass-strength-result" <?php echo 'class="' . esc_attr($atts['class']) . '"' . $other_atts_html; ?>><?php _e('Strength indicator','wp-user-avatar'); ?></div>
100 <script type="text/javascript">
101 var pass_strength = 0;
102 jQuery(document).ready(function ($) {
103 var password1 = $('input[name=eup_password]');
104 var password2 = $('input[name=eup_password2]');
105 var submitButton = $('input[name=eup_submit]');
106 var strengthMeterId = $('#pp-pass-strength-result');
107
108 $('body').on('keyup', 'input[name=eup_password], input[name=eup_password2]',
109 function (event) {
110 pp_checkPasswordStrength(password1, password2, strengthMeterId, submitButton, []);
111 }
112 );
113
114 if (password1.val() != '') {
115 // trigger 'keyup' event to check password strength when password field isn't empty.
116 $('body input[name=eup_password]').trigger('keyup');
117 }
118
119 submitButton.on('click', function () {
120 $('input[name=pp_enforce_password_meter]').val(pass_strength);
121 });
122 });
123
124 function pp_checkPasswordStrength($pass1, $pass2, $strengthResult, $submitButton, blacklistArray) {
125 var min_password_strength = <?php echo apply_filters('ppress_min_password_strength', 4); ?>;
126 var pass1 = $pass1.val();
127 var pass2 = $pass2.val();
128
129 <?php if('true' == $atts['enforce']) : ?>
130 // Reset the form & meter
131 $submitButton.attr('disabled', 'disabled').css("opacity", ".4");
132 <?php endif; ?>
133 $strengthResult.removeClass('short bad good strong');
134
135 // Extend our blacklist array with those from the inputs & site data
136 blacklistArray = blacklistArray.concat(wp.passwordStrength.userInputBlacklist());
137
138 // Get the password strength
139 var strength = wp.passwordStrength.meter(pass1, blacklistArray, pass2);
140
141 // Add the strength meter results
142 switch (strength) {
143 case 2:
144 $strengthResult.addClass('bad').html(pwsL10n.bad);
145 break;
146 case 3:
147 $strengthResult.addClass('good').html(pwsL10n.good);
148 if (min_password_strength === 3) {
149 pass_strength = 1;
150 }
151 break;
152 case 4:
153 $strengthResult.addClass('strong').html(pwsL10n.strong);
154 if (min_password_strength === 4) {
155 pass_strength = 1;
156 }
157 break;
158 case 5:
159 $strengthResult.addClass('short').html(pwsL10n.mismatch);
160 break;
161 default:
162 $strengthResult.addClass('short').html(pwsL10n.short);
163 }
164
165 // The meter function returns a result even if pass2 is empty,
166 // enable only the submit button if the password is strong
167 <?php if('true' == $atts['enforce']) : ?>
168 if (min_password_strength <= strength) {
169 $submitButton.removeAttr('disabled').css("opacity", "");
170 }
171 <?php endif; ?>
172
173 return strength;
174 }
175 </script>
176 <?php
177 return apply_filters('ppress_edit_profile_password_meter_field', ob_get_clean(), $atts);
178 }
179
180 public static function get_instance()
181 {
182 static $instance = false;
183
184 if ( ! $instance) {
185 $instance = new self;
186 }
187
188 return $instance;
189 }
190 }