PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.3.4
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.3.4
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.3.4, at index.php

246 lines 12.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.3.4
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><?php printf( __( '%s is also activated. You need to deactivate it before activating this version of the plugin.', 'profile-builder'), PROFILE_BUILDER ); ?></p>
39 </div>
40 <?php
41 }
42 function wppb_plugin_deactivate() {
43 deactivate_plugins( plugin_basename( __FILE__ ) );
44 unset($_GET['activate']);
45 }
46
47 add_action('admin_notices', 'wppb_admin_notice');
48 add_action( 'admin_init', 'wppb_plugin_deactivate' );
49 } else {
50
51 /**
52 * Convert memory value from ini file to a readable form
53 *
54 * @since v.1.0
55 *
56 * @return integer
57 */
58 function wppb_return_bytes($val)
59 {
60 return wp_convert_hr_to_bytes($val);
61 }
62
63 /**
64 * Definitions
65 *
66 *
67 */
68 define('PROFILE_BUILDER_VERSION', '3.3.4' );
69 define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
70 define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
71 define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
72 define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
73 define('WPPB_TRANSLATE_DOMAIN', 'profile-builder');
74
75 /* include notices class */
76 if (file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php'))
77 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
78
79 if (file_exists(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php'))
80 define('PROFILE_BUILDER', 'Profile Builder Pro');
81 elseif (file_exists(WPPB_PLUGIN_DIR . '/front-end/extra-fields/extra-fields.php'))
82 define('PROFILE_BUILDER', 'Profile Builder Hobbyist');
83 else
84 define('PROFILE_BUILDER', 'Profile Builder Free');
85
86 /**
87 * Initialize the translation for the Plugin.
88 *
89 * @since v.1.0
90 *
91 * @return null
92 */
93 function wppb_init_translation()
94 {
95 $current_theme = wp_get_theme();
96 if( !empty( $current_theme->stylesheet ) && file_exists( get_theme_root().'/'. $current_theme->stylesheet .'/local_pb_lang' ) )
97 load_plugin_textdomain( 'profile-builder', false, basename( dirname( __FILE__ ) ).'/../../themes/'.$current_theme->stylesheet.'/local_pb_lang' );
98 else
99 load_plugin_textdomain( 'profile-builder', false, basename(dirname(__FILE__)) . '/translation/' );
100 }
101
102 add_action('init', 'wppb_init_translation', 8);
103
104
105 /**
106 * Required files
107 *
108 *
109 */
110 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
111 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
112 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
113 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
114 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
115 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
116 include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php');
117 include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php');
118 include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
119 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
120 include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
121 //include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7
122 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
123 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
124 if (file_exists(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php')) {
125 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
126 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
127 }
128 if ( wppb_conditional_fields_exists() ) {
129 include_once(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
130 }
131 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
132 include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php');
133 include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php');
134
135 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
136 include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
137 include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
138 }
139
140 if (file_exists(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php')) {
141 include_once(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php');
142 include_once(WPPB_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php');
143 include_once(WPPB_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php');
144 include_once(WPPB_PLUGIN_DIR . '/add-ons/email-customizer/email-customizer.php');
145 include_once(WPPB_PLUGIN_DIR . '/add-ons/multiple-forms/multiple-forms.php');
146 include_once(WPPB_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php');
147
148 $wppb_module_settings = get_option('wppb_module_settings');
149 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
150 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
151 } else
152 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
153
154 $wppb_email_customizer_activate = 'hide';
155 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' ) )
156 $wppb_email_customizer_activate = 'show';
157
158 if ( $wppb_email_customizer_activate == 'show')
159 include_once(WPPB_PLUGIN_DIR . '/add-ons/email-customizer/admin-email-customizer.php');
160
161 if ( $wppb_email_customizer_activate == 'show' )
162 include_once(WPPB_PLUGIN_DIR . '/add-ons/email-customizer/user-email-customizer.php');
163 }
164
165 include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
166 include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
167
168 /* added recaptcha and user role field since version 2.6.2 */
169 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
170
171 //Elementor Content Restriction
172 global $content_restriction_activated;
173 if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) {
174 if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) )
175 include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php';
176 }
177
178 //Include Free Add-ons
179 $wppb_free_add_ons_settings = get_option( 'wppb_free_add_ons_settings', array() );
180 if( !empty( $wppb_free_add_ons_settings ) ){
181
182 if( isset( $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ) && $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ){
183 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php' ) )
184 include_once WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php';
185 }
186
187 if( isset( $wppb_free_add_ons_settings['gdpr-communication-preferences'] ) && $wppb_free_add_ons_settings['gdpr-communication-preferences'] ){
188 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php' ) )
189 include_once WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php';
190 }
191
192 if( isset( $wppb_free_add_ons_settings['import-export'] ) && $wppb_free_add_ons_settings['import-export'] ){
193 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php' ) )
194 include_once WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php';
195 }
196
197 if( isset( $wppb_free_add_ons_settings['labels-edit'] ) && $wppb_free_add_ons_settings['labels-edit'] ){
198 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php' ) )
199 include_once WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php';
200 }
201
202 if( isset( $wppb_free_add_ons_settings['maximum-character-length'] ) && $wppb_free_add_ons_settings['maximum-character-length'] ){
203 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) )
204 include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php';
205 }
206
207 }
208
209 /**
210 * Check for updates
211 *
212 *
213 */
214 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
215 if (file_exists(WPPB_PLUGIN_DIR . '/add-ons/add-ons.php')) {
216 $localSerial = get_option('wppb_profile_builder_pro_serial');
217 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', __FILE__, 'profile-builder-pro-update');
218
219 } else {
220 $localSerial = get_option('wppb_profile_builder_hobbyist_serial');
221 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', __FILE__, 'profile-builder-hobbyist-update');
222 }
223 }
224
225
226 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
227 add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
228 add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
229
230 }
231 } //end wppb_free_plugin_init
232 add_action( 'plugins_loaded', 'wppb_free_plugin_init' );
233
234 if (file_exists( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php'))
235 include_once( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php');
236
237 /* add a redirect when plugin is activated */
238 if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
239 function wppb_activate_plugin_redirect( $plugin ) {
240 if( $plugin == plugin_basename( __FILE__ ) ) {
241 exit( wp_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) ) );
242 }
243 }
244 add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
245 }
246