PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.5.5
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.5.5
4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 All 339 releases
profile-builder / index.php

index.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.5.5, at index.php

271 lines 13.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Profile Builder
4 Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5 Description: Login, registration and edit profile shortcodes for the front-end. Also you can choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6 Version: 3.5.5
7 Author: Cozmoslabs
8 Author URI: https://www.cozmoslabs.com/
9 Text Domain: profile-builder
10 Domain Path: /translation
11 License: GPL2
12
13 == Copyright ==
14 Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
15
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version.
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
31 /* Check if another version of Profile Builder is activated, to prevent fatal errors*/
32 function wppb_free_plugin_init() {
33 if (function_exists('wppb_return_bytes')) {
34 function wppb_admin_notice()
35 {
36 ?>
37 <div class="error">
38 <p>
39 <?php
40 /* translators: %s is the plugin version name */
41 echo wp_kses_post( sprintf( __( '%s is also activated. You need to deactivate it before activating this version of the plugin.', 'profile-builder'), PROFILE_BUILDER ) );
42 ?>
43 </p>
44 </div>
45 <?php
46 }
47 function wppb_plugin_deactivate() {
48 deactivate_plugins( plugin_basename( __FILE__ ) );
49 unset($_GET['activate']);
50 }
51
52 add_action('admin_notices', 'wppb_admin_notice');
53 add_action( 'admin_init', 'wppb_plugin_deactivate' );
54 } else {
55
56 /**
57 * Convert memory value from ini file to a readable form
58 *
59 * @since v.1.0
60 *
61 * @return integer
62 */
63 function wppb_return_bytes($val)
64 {
65 return wp_convert_hr_to_bytes($val);
66 }
67
68 /**
69 * Definitions
70 *
71 *
72 */
73 define('PROFILE_BUILDER_VERSION', '3.5.5' );
74 define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
75 define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
76 define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
77 define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
78 define('WPPB_TRANSLATE_DOMAIN', 'profile-builder');
79
80 /* include notices class */
81 if (file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php'))
82 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
83
84 /* include review class */
85 if (file_exists(WPPB_PLUGIN_DIR . '/admin/review.php')){
86 include_once(WPPB_PLUGIN_DIR . '/admin/review.php');
87 $wppb_review_request = new WPPB_Review_Request ();
88 }
89
90 if (file_exists(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php'))
91 define('PROFILE_BUILDER', 'Profile Builder Pro');
92 elseif (file_exists(WPPB_PLUGIN_DIR . '/front-end/extra-fields/extra-fields.php'))
93 define('PROFILE_BUILDER', 'Profile Builder Hobbyist');
94 else
95 define('PROFILE_BUILDER', 'Profile Builder Free');
96
97 /**
98 * Initialize the translation for the Plugin.
99 *
100 * @since v.1.0
101 *
102 * @return null
103 */
104 function wppb_init_translation()
105 {
106 $current_theme = wp_get_theme();
107 if( !empty( $current_theme->stylesheet ) && file_exists( get_theme_root().'/'. $current_theme->stylesheet .'/local_pb_lang' ) )
108 load_plugin_textdomain( 'profile-builder', false, basename( dirname( __FILE__ ) ).'/../../themes/'.$current_theme->stylesheet.'/local_pb_lang' );
109 else
110 load_plugin_textdomain( 'profile-builder', false, basename(dirname(__FILE__)) . '/translation/' );
111 }
112
113 add_action('init', 'wppb_init_translation', 8);
114
115
116 /**
117 * Required files
118 *
119 *
120 */
121 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
122 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
123 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
124 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
125 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
126 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
127 include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php');
128 include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php');
129 include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
130 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
131 include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
132 //include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7
133 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
134 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
135 if (file_exists(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php')) {
136 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
137 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
138 }
139 if ( wppb_conditional_fields_exists() ) {
140 include_once(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
141 }
142 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
143 include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php');
144 include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php');
145
146 /* include 2fa class */
147 if (file_exists(WPPB_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php')){
148 include_once(WPPB_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php');
149 new WPPB_Two_Factor_Authenticator ();
150 }
151
152
153 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
154 include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
155 include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
156 }
157
158 if (file_exists(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php')) {
159 include_once(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php');
160 include_once(WPPB_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php');
161 include_once(WPPB_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php');
162 include_once(WPPB_PLUGIN_DIR . '/add-ons/email-customizer/email-customizer.php');
163 include_once(WPPB_PLUGIN_DIR . '/add-ons/multiple-forms/multiple-forms.php');
164 include_once(WPPB_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php');
165
166 $wppb_module_settings = get_option('wppb_module_settings');
167 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
168 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
169 } else
170 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
171
172 $wppb_email_customizer_activate = 'hide';
173 if ( ( !empty( $wppb_module_settings['wppb_emailCustomizer'] ) && $wppb_module_settings['wppb_emailCustomizer'] == 'show' ) || ( !empty( $wppb_module_settings['wppb_emailCustomizerAdmin'] ) && $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) )
174 $wppb_email_customizer_activate = 'show';
175
176 if ( $wppb_email_customizer_activate == 'show')
177 include_once(WPPB_PLUGIN_DIR . '/add-ons/email-customizer/admin-email-customizer.php');
178
179 if ( $wppb_email_customizer_activate == 'show' )
180 include_once(WPPB_PLUGIN_DIR . '/add-ons/email-customizer/user-email-customizer.php');
181 }
182
183 include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
184 include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
185
186 /* added recaptcha and user role field since version 2.6.2 */
187 include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/recaptcha/recaptcha.php'); //need to load this here for displaying reCAPTCHA on Login and Recover Password forms
188
189 //Elementor Widgets
190 if ( did_action( 'elementor/loaded' ) ) {
191 if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'))
192 include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php';
193 }
194
195 //Elementor Content Restriction
196 global $content_restriction_activated;
197 if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) {
198 if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) )
199 include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php';
200 }
201
202 //Include Free Add-ons
203 $wppb_free_add_ons_settings = get_option( 'wppb_free_add_ons_settings', array() );
204 if( !empty( $wppb_free_add_ons_settings ) ){
205
206 if( isset( $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ) && $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ){
207 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php' ) )
208 include_once WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php';
209 }
210
211 if( isset( $wppb_free_add_ons_settings['gdpr-communication-preferences'] ) && $wppb_free_add_ons_settings['gdpr-communication-preferences'] ){
212 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php' ) )
213 include_once WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php';
214 }
215
216 if( isset( $wppb_free_add_ons_settings['import-export'] ) && $wppb_free_add_ons_settings['import-export'] ){
217 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php' ) )
218 include_once WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php';
219 }
220
221 if( isset( $wppb_free_add_ons_settings['labels-edit'] ) && $wppb_free_add_ons_settings['labels-edit'] ){
222 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php' ) )
223 include_once WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php';
224 }
225
226 if( isset( $wppb_free_add_ons_settings['maximum-character-length'] ) && $wppb_free_add_ons_settings['maximum-character-length'] ){
227 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) )
228 include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php';
229 }
230
231 }
232
233 /**
234 * Check for updates
235 *
236 *
237 */
238 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
239 if (file_exists(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php')) {
240 $localSerial = get_option('wppb_profile_builder_pro_serial');
241 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', __FILE__, 'profile-builder-pro-update');
242
243 } else {
244 $localSerial = get_option('wppb_profile_builder_hobbyist_serial');
245 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', __FILE__, 'profile-builder-hobbyist-update');
246 }
247 }
248
249
250 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
251 add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
252 add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
253
254 }
255 } //end wppb_free_plugin_init
256 add_action( 'plugins_loaded', 'wppb_free_plugin_init' );
257
258 if (file_exists( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php'))
259 include_once( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php');
260
261 /* add a redirect when plugin is activated */
262 if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
263 function wppb_activate_plugin_redirect( $plugin ) {
264 if( !wp_doing_ajax() && $plugin == plugin_basename( __FILE__ ) ) {
265 wp_safe_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) );
266 exit();
267 }
268 }
269 add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
270 }
271