PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.1
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.1
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 5 years ago FieldsShortcodeCallback.php 5 years ago FrontendProfileBuilder.php 5 years ago GlobalShortcodes.php 5 years ago LoginFormBuilder.php 5 years ago PasswordResetBuilder.php 5 years ago RegistrationFormBuilder.php 5 years ago builder-preview.php 5 years ago index.php 5 years ago
EditProfileBuilder.php
186 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 wp_localize_script('password-strength-meter', 'pwsL10n', array(
82 'empty' => esc_html__('Strength indicator'),
83 'short' => esc_html__('Very weak'),
84 'bad' => esc_html__('Weak'),
85 'good' => _x('Medium', 'password strength'),
86 'strong' => esc_html__('Strong'),
87 'mismatch' => esc_html__('Mismatch'),
88 ));
89
90 ob_start(); ?>
91
92 <?php if ('true' == $atts['enforce']) : ?>
93 <input type="hidden" name="pp_enforce_password_meter" value="true">
94 <?php endif; ?>
95 <div id="pp-pass-strength-result" <?php echo 'class="' . $atts['class'] . '"' . $other_atts_html; ?>><?php _e('Strength indicator'); ?></div>
96 <script type="text/javascript">
97 var pass_strength = 0;
98 jQuery(document).ready(function ($) {
99 var password1 = $('input[name=eup_password]');
100 var password2 = $('input[name=eup_password2]');
101 var submitButton = $('input[name=eup_submit]');
102 var strengthMeterId = $('#pp-pass-strength-result');
103
104 $('body').on('keyup', 'input[name=eup_password], input[name=eup_password2]',
105 function (event) {
106 pp_checkPasswordStrength(password1, password2, strengthMeterId, submitButton, []);
107 }
108 );
109
110 if (password1.val() != '') {
111 // trigger 'keyup' event to check password strength when password field isn't empty.
112 $('body input[name=eup_password]').trigger('keyup');
113 }
114
115 submitButton.click(function () {
116 $('input[name=pp_enforce_password_meter]').val(pass_strength);
117 });
118 });
119
120 function pp_checkPasswordStrength($pass1, $pass2, $strengthResult, $submitButton, blacklistArray) {
121 var min_password_strength = <?php echo apply_filters('ppress_min_password_strength', 4); ?>;
122 var pass1 = $pass1.val();
123 var pass2 = $pass2.val();
124
125 <?php if('true' == $atts['enforce']) : ?>
126 // Reset the form & meter
127 $submitButton.attr('disabled', 'disabled').css("opacity", ".4");
128 <?php endif; ?>
129 $strengthResult.removeClass('short bad good strong');
130
131 // Extend our blacklist array with those from the inputs & site data
132 blacklistArray = blacklistArray.concat(wp.passwordStrength.userInputBlacklist());
133
134 // Get the password strength
135 var strength = wp.passwordStrength.meter(pass1, blacklistArray, pass2);
136
137 // Add the strength meter results
138 switch (strength) {
139 case 2:
140 $strengthResult.addClass('bad').html(pwsL10n.bad);
141 break;
142 case 3:
143 $strengthResult.addClass('good').html(pwsL10n.good);
144 if (min_password_strength === 3) {
145 pass_strength = 1;
146 }
147 break;
148 case 4:
149 $strengthResult.addClass('strong').html(pwsL10n.strong);
150 if (min_password_strength === 4) {
151 pass_strength = 1;
152 }
153 break;
154 case 5:
155 $strengthResult.addClass('short').html(pwsL10n.mismatch);
156 break;
157 default:
158 $strengthResult.addClass('short').html(pwsL10n.short);
159 }
160
161 // The meter function returns a result even if pass2 is empty,
162 // enable only the submit button if the password is strong
163 <?php if('true' == $atts['enforce']) : ?>
164 if (min_password_strength <= strength) {
165 $submitButton.removeAttr('disabled').css("opacity", "");
166 }
167 <?php endif; ?>
168
169 return strength;
170 }
171 </script>
172 <?php
173 return apply_filters('ppress_edit_profile_password_meter_field', ob_get_clean(), $atts);
174 }
175
176 public static function get_instance()
177 {
178 static $instance = false;
179
180 if ( ! $instance) {
181 $instance = new self;
182 }
183
184 return $instance;
185 }
186 }