PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 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 All 341 releases
← All changes | index.php +437 -94 2.0.64.0.3 View file →
@@ -1,30 +1,38 @@
1 1 <?php
2 -/*
3 -Plugin Name: Profile Builder
4 -Plugin URI: http://www.cozmoslabs.com/wordpress-profile-builder/
5 -Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6 -Version: 2.0.6
7 -Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel
8 -Author URI: http://www.cozmoslabs.com/
9 -License: GPL2
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: 4.0.3
7 + * Author: Cozmoslabs
8 + * Author URI: https://www.cozmoslabs.com/
9 + * Text Domain: profile-builder
10 + * Domain Path: /translation
11 + * License: GPL2
12 + * WC requires at least: 3.0.0
13 + * WC tested up to: 11.1
14 + * Elementor tested up to: 4.3.0
15 + * Elementor Pro tested up to: 4.3.0
16 + *
17 + * == Copyright ==
18 + * Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
19 + *
20 + * This program is free software; you can redistribute it and/or modify
21 + * it under the terms of the GNU General Public License as published by
22 + * the Free Software Foundation; either version 2 of the License, or
23 + * (at your option) any later version.
24 + * This program is distributed in the hope that it will be useful,
25 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 + * GNU General Public License for more details.
28 + * You should have received a copy of the GNU General Public License
29 + * along with this program; if not, write to the Free Software
30 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 +*/
10 32
11 -== Copyright ==
12 -Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
33 +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13 34
14 -This program is free software; you can redistribute it and/or modify
15 -it under the terms of the GNU General Public License as published by
16 -the Free Software Foundation; either version 2 of the License, or
17 -(at your option) any later version.
18 -This program is distributed in the hope that it will be useful,
19 -but WITHOUT ANY WARRANTY; without even the implied warranty of
20 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 -GNU General Public License for more details.
22 -You should have received a copy of the GNU General Public License
23 -along with this program; if not, write to the Free Software
24 -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 -*/
26 -
27 35 /* Check if another version of Profile Builder is activated, to prevent fatal errors*/
28 36 function wppb_plugin_init() {
29 37 if (function_exists('wppb_return_bytes')) {
30 38 function wppb_admin_notice()
@@ -30,9 +38,14 @@
30 38 function wppb_admin_notice()
31 39 {
32 40 ?>
33 41 <div class="error">
34 - <p><?php _e( PROFILE_BUILDER . ' is also activated. You need to deactivate it before activating this version of the plugin.', 'profilebuilder'); ?></p>
42 + <p>
43 + <?php
44 + /* translators: %s is the plugin version name */
45 + 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 ) );
46 + ?>
47 + </p>
35 48 </div>
36 49 <?php
37 50 }
38 51 function wppb_plugin_deactivate() {
@@ -52,48 +65,20 @@
52 65 * @return integer
53 66 */
54 67 function wppb_return_bytes($val)
55 68 {
56 - $val = trim($val);
57 -
58 - switch (strtolower($val[strlen($val) - 1])) {
59 - // The 'G' modifier is available since PHP 5.1.0
60 - case 'g':
61 - $val *= 1024;
62 - case 'm':
63 - $val *= 1024;
64 - case 'k':
65 - $val *= 1024;
66 - }
67 -
68 - return $val;
69 + return wp_convert_hr_to_bytes($val);
69 70 }
70 71
71 - /**
72 - * Definitions
73 - *
74 - *
75 - */
76 - define('PROFILE_BUILDER_VERSION', '2.0.6' );
77 - define('WPPB_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)));
78 - define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
79 - define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
80 - define('WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA', apply_filters('wppb_server_max_upload_size_mega_constant', ini_get('upload_max_filesize')));
81 - define('WPPB_SERVER_MAX_POST_SIZE_BYTE', apply_filters('wppb_server_max_post_size_byte_constant', wppb_return_bytes(ini_get('post_max_size'))));
82 - define('WPPB_SERVER_MAX_POST_SIZE_MEGA', apply_filters('wppb_server_max_post_size_mega_constant', ini_get('post_max_size')));
83 - define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
84 - define('WPPB_TRANSLATE_DOMAIN', 'profilebuilder');
85 -
86 72 /* include notices class */
87 - if (file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php'))
73 + if ( file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php') )
88 74 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
89 75
90 - if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.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');
76 + /* include review class */
77 + if (file_exists(WPPB_PLUGIN_DIR . '/admin/review.php')){
78 + include_once(WPPB_PLUGIN_DIR . '/admin/review.php');
79 + $wppb_review_request = new WPPB_Review_Request ();
80 + }
96 81
97 82 /**
98 83 * Initialize the translation for the Plugin.
99 84 *
@@ -100,11 +85,14 @@
100 85 * @since v.1.0
101 86 *
102 87 * @return null
103 88 */
104 - function wppb_init_translation()
105 - {
106 - load_plugin_textdomain('profilebuilder', false, basename(dirname(__FILE__)) . '/translation/');
89 + function wppb_init_translation(){
90 + $current_theme = wp_get_theme();
91 + if( !empty( $current_theme->stylesheet ) && file_exists( get_theme_root().'/'. $current_theme->stylesheet .'/local_pb_lang' ) )
92 + load_plugin_textdomain( 'profile-builder', false, basename( dirname( __FILE__ ) ).'/../../themes/'.$current_theme->stylesheet.'/local_pb_lang' );
93 + else
94 + load_plugin_textdomain( 'profile-builder', false, basename(dirname(__FILE__)) . '/translation/' );
107 95 }
108 96
109 97 add_action('init', 'wppb_init_translation', 8);
110 98
@@ -117,66 +105,421 @@
117 105 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
118 106 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
119 107 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
120 108 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
109 + include_once(WPPB_PLUGIN_DIR . '/admin/setup-wizard.php');
110 + include_once(WPPB_PLUGIN_DIR . '/admin/dashboard.php');
121 111 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
122 112 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
123 - include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php');
113 + include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php');
114 + include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
124 115 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
116 + include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
117 + include_once(WPPB_PLUGIN_DIR . '/admin/support-chat.php');
118 + //include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7
125 119 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
126 120 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
127 - if (file_exists(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php')) {
128 - include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
129 - include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
121 +
122 + if( file_exists( WPPB_PLUGIN_DIR . '/admin/plugin-optin/class-plugin-optin.php' ) ){
123 + include_once( WPPB_PLUGIN_DIR . '/admin/plugin-optin/class-plugin-optin.php' );
130 124 }
125 +
126 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php' ) ) {
127 + include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
128 + include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
129 + }
130 +
131 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php' ) ) {
132 + include_once(WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php');
133 + }
134 +
135 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/color-switcher.php' ) ) {
136 + include_once( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/color-switcher.php' );
137 + }
138 +
139 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/ajax/ajax-functions.php' ) ) {
140 + include_once( WPPB_PAID_PLUGIN_DIR . '/features/ajax/ajax-functions.php' );
141 + }
142 +
143 + if ( wppb_conditional_fields_exists() ) {
144 + include_once(WPPB_PAID_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
145 + }
146 +
131 147 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
148 + include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php');
149 + include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php');
132 150
133 - if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
134 - include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
135 - include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
151 + /* include 2fa class */
152 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ) ){
153 + include_once( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' );
154 + new WPPB_Two_Factor_Authenticator();
136 155 }
137 156
138 - if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
139 - include_once(WPPB_PLUGIN_DIR . '/modules/modules.php');
140 - include_once(WPPB_PLUGIN_DIR . '/modules/custom-redirects/custom-redirects.php');
141 - include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/email-customizer.php');
142 - include_once(WPPB_PLUGIN_DIR . '/modules/multiple-forms/multiple-forms.php');
157 + if ( file_exists( WPPB_PLUGIN_DIR . '/admin/register-version.php' ) ) {
158 + include_once( WPPB_PLUGIN_DIR . '/admin/register-version.php' );
159 + }
143 160
161 + // Forms Rework (free): default forms always; extra forms need paid
162 + // (wppb_fb_multiple_forms_available). require_once — silent skip would
163 + // break per-form field lists with no error.
164 + require_once( WPPB_PLUGIN_DIR . 'form-builder/form-builder-init.php' );
165 +
166 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) {
167 +
168 + include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php');
169 + // include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php');
170 + include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php');
171 + include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php');
172 +
173 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' ) )
174 + include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' );
175 +
144 176 $wppb_module_settings = get_option('wppb_module_settings');
145 177 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
146 - include_once(WPPB_PLUGIN_DIR . '/modules/user-listing/userlisting.php');
147 178 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
148 179 } else
149 180 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
150 181
151 - if (isset($wppb_module_settings['wppb_emailCustomizerAdmin']) && ($wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show'))
152 - include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/admin-email-customizer.php');
182 + }
153 183
154 - if (isset($wppb_module_settings['wppb_emailCustomizer']) && ($wppb_module_settings['wppb_emailCustomizer'] == 'show'))
155 - include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/user-email-customizer.php');
184 + // Email Customizer is in free since 3.8.1
185 + if( file_exists( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ) ){
186 + include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' );
187 + include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/admin-email-customizer.php' );
188 + include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/user-email-customizer.php' );
156 189 }
157 190
191 + include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
192 + include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
158 193
159 - /**
160 - * Check for updates
161 - *
162 - *
163 - */
164 - if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
165 - if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
166 - $localSerial = get_option('wppb_profile_builder_pro_serial');
167 - $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', __FILE__, 'profile-builder-pro-update');
194 + /* added recaptcha and user role field since version 2.6.2 */
195 + 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
168 196
169 - } else {
170 - $localSerial = get_option('wppb_profile_builder_hobbyist_serial');
171 - $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', __FILE__, 'profile-builder-hobbyist-update');
197 + /* added turnstile field since version 3.15. */
198 + include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/turnstile/turnstile.php');
199 +
200 + // Elementor PRO
201 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php' ) ) {
202 + $active_wp_plugins = get_option('active_plugins');
203 +
204 + if ( !empty( $active_wp_plugins ) && in_array( 'elementor-pro/elementor-pro.php', $active_wp_plugins ) )
205 + include_once(WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php');
206 + }
207 +
208 + //Elementor Widgets
209 + if ( did_action( 'elementor/loaded' ) ) {
210 + if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'))
211 + include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php';
212 + }
213 +
214 + //Divi Extension
215 + if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php'))
216 + include_once WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php';
217 +
218 + //Block Editor Assets
219 + global $wp_version;
220 + if ( version_compare( $wp_version, "5.0.0", ">=" ) ) {
221 + if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php' ) )
222 + include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php';
223 + }
224 +
225 + //Block Content Restriction
226 + global $content_restriction_activated;
227 + if ( $content_restriction_activated == 'yes' && version_compare( $wp_version, "5.0.0", ">=" ) ) {
228 + if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php' ) )
229 + include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php';
230 + }
231 +
232 + //Elementor Content Restriction
233 + if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) {
234 + if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) )
235 + include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php';
236 + }
237 +
238 + //Include Free Add-ons
239 + $wppb_free_add_ons_settings = get_option( 'wppb_free_add_ons_settings', array() );
240 + if( !empty( $wppb_free_add_ons_settings ) ){
241 +
242 + if( isset( $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ) && $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ){
243 + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php' ) )
244 + include_once WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php';
172 245 }
246 +
247 + if( isset( $wppb_free_add_ons_settings['gdpr-communication-preferences'] ) && $wppb_free_add_ons_settings['gdpr-communication-preferences'] ){
248 + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php' ) )
249 + include_once WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php';
250 + }
251 +
252 + if( isset( $wppb_free_add_ons_settings['import-export'] ) && $wppb_free_add_ons_settings['import-export'] ){
253 + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php' ) )
254 + include_once WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php';
255 + }
256 +
257 + if( isset( $wppb_free_add_ons_settings['labels-edit'] ) && $wppb_free_add_ons_settings['labels-edit'] ){
258 + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php' ) )
259 + include_once WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php';
260 + }
261 +
262 + if( isset( $wppb_free_add_ons_settings['maximum-character-length'] ) && $wppb_free_add_ons_settings['maximum-character-length'] ){
263 + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) )
264 + include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php';
265 + }
266 +
267 + if( isset( $wppb_free_add_ons_settings['user-profile-picture'] ) && $wppb_free_add_ons_settings['user-profile-picture'] ){
268 + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php' ) )
269 + include_once WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php';
270 + }
271 +
173 272 }
174 273
274 + //Include Advanced Add-ons
175 275
276 + if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){
277 +
278 + $wppb_advanced_add_ons_settings = get_option( 'wppb_advanced_add_ons_settings', array() );
279 + if( !empty( $wppb_advanced_add_ons_settings ) ){
280 +
281 + if( isset( $wppb_advanced_add_ons_settings['buddypress'] ) && $wppb_advanced_add_ons_settings['buddypress'] ){
282 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php' ) )
283 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php';
284 + }
285 +
286 + if( isset( $wppb_advanced_add_ons_settings['social-connect'] ) && $wppb_advanced_add_ons_settings['social-connect'] ){
287 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php' ) )
288 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php';
289 + }
290 +
291 + if( isset( $wppb_advanced_add_ons_settings['woocommerce'] ) && $wppb_advanced_add_ons_settings['woocommerce'] ){
292 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php' ) )
293 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php';
294 + }
295 +
296 + if( isset( $wppb_advanced_add_ons_settings['multi-step-forms'] ) && $wppb_advanced_add_ons_settings['multi-step-forms'] ){
297 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php' ) )
298 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php';
299 + }
300 +
301 + if( isset( $wppb_advanced_add_ons_settings['form-fields-in-columns'] ) && $wppb_advanced_add_ons_settings['form-fields-in-columns'] ){
302 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php' ) )
303 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php';
304 + }
305 +
306 + if( isset( $wppb_advanced_add_ons_settings['mailchimp-integration'] ) && $wppb_advanced_add_ons_settings['mailchimp-integration'] ){
307 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php' ) )
308 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php';
309 + }
310 +
311 + if( isset( $wppb_advanced_add_ons_settings['bbpress'] ) && $wppb_advanced_add_ons_settings['bbpress'] ){
312 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php' ) )
313 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php';
314 + }
315 +
316 + if( isset( $wppb_advanced_add_ons_settings['campaign-monitor'] ) && $wppb_advanced_add_ons_settings['campaign-monitor'] ){
317 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php' ) )
318 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php';
319 + }
320 +
321 + if( isset( $wppb_advanced_add_ons_settings['field-visibility'] ) && $wppb_advanced_add_ons_settings['field-visibility'] ){
322 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php' ) )
323 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php';
324 + }
325 +
326 + if( isset( $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ) && $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ){
327 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php' ) )
328 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php';
329 + }
330 +
331 + if( isset( $wppb_advanced_add_ons_settings['custom-profile-menus'] ) && $wppb_advanced_add_ons_settings['custom-profile-menus'] ){
332 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php' ) )
333 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php';
334 + }
335 +
336 + if( isset( $wppb_advanced_add_ons_settings['mailpoet-integration'] ) && $wppb_advanced_add_ons_settings['mailpoet-integration'] ){
337 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php' ) )
338 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php';
339 + }
340 +
341 + if( isset( $wppb_advanced_add_ons_settings['progress-bar'] ) && $wppb_advanced_add_ons_settings['progress-bar'] ){
342 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/progress-bar/index.php' ) )
343 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/progress-bar/index.php';
344 + }
345 +
346 + }
347 +
348 + /**
349 + * Include add-on files that contain activation hooks even when add-ons are deactivated
350 + *
351 + * Necessary in order to perform actions during the operation of activation or deactivation of that add-on
352 + */
353 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php') )
354 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php';
355 +
356 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php') )
357 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php';
358 +
359 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php') )
360 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php';
361 +
362 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php') )
363 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php';
364 +
365 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php') )
366 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php';
367 +
368 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php') )
369 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php';
370 +
371 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php') )
372 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php';
373 +
374 + }
375 +
376 +
176 377 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
177 - register_activation_hook(__FILE__, 'wppb_generate_default_settings_defaults'); //prepoulate general settings
178 - register_activation_hook(__FILE__, 'wppb_prepopulate_fields'); //prepopulate manage fields list
378 + add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
379 + add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
179 380
180 381 }
181 382 } //end wppb_plugin_init
182 -add_action( 'plugins_loaded', 'wppb_plugin_init' );
383 +add_action( 'plugins_loaded', 'wppb_plugin_init' );
384 +
385 +/**
386 + * Definitions
387 + *
388 + *
389 + */
390 +define('PROFILE_BUILDER_VERSION', '4.0.3' );
391 +define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
392 +define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
393 +define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
394 +define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
395 +define('WPPB_TRANSLATE_DOMAIN', 'profile-builder');
396 +
397 +// Determine which plugin version is active
398 +$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
399 +$active_network_plugins = get_site_option('active_sitewide_plugins');
400 +
401 +if ( in_array( 'profile-builder-pro/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-pro/index.php'] ) ){
402 +
403 + define('PROFILE_BUILDER', 'Profile Builder Pro');
404 + define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-pro' );
405 + define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-pro/' );
406 +
407 +} elseif ( in_array( 'profile-builder-dev/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-dev/index.php'] ) ){
408 +
409 + define('PROFILE_BUILDER', 'Profile Builder Pro');
410 + define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-dev' );
411 + define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' );
412 + define('PROFILE_BUILDER_PAID_VERSION', 'dev' );
413 +
414 +} elseif ( in_array( 'profile-builder-agency/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-agency/index.php'] ) ){
415 +
416 + define('PROFILE_BUILDER', 'Profile Builder Agency');
417 + define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-agency' );
418 + define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-agency/' );
419 +
420 +} elseif ( in_array( 'profile-builder-unlimited/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-unlimited/index.php'] ) ){
421 +
422 + define('PROFILE_BUILDER', 'Profile Builder Unlimited');
423 + define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-unlimited' );
424 + define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-unlimited/' );
425 +
426 +} elseif ( in_array( 'profile-builder-hobbyist/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-hobbyist/index.php'] ) ){
427 +
428 + define('PROFILE_BUILDER', 'Profile Builder Basic');
429 + define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-hobbyist' );
430 + define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-hobbyist/' );
431 +
432 +} else
433 + define('PROFILE_BUILDER', 'Profile Builder Free');
434 +
435 +if ( ! function_exists( 'wppb_paid_plugin_owns_updates' ) ) {
436 + function wppb_paid_plugin_owns_updates() {
437 +
438 + if ( ! defined( 'WPPB_PAID_PLUGIN_DIR' ) || ! defined( 'WPPB_PLUGIN_DIR' ) )
439 + return false;
440 +
441 + if ( trailingslashit( WPPB_PAID_PLUGIN_DIR ) === trailingslashit( WPPB_PLUGIN_DIR ) )
442 + return false;
443 +
444 + return file_exists( WPPB_PAID_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php' );
445 +
446 + }
447 +}
448 +
449 +/**
450 + * Load the EDD updater from the paid wrapper when it owns updates.
451 + */
452 +if ( ! function_exists( 'wppb_paid_plugin_load_updater' ) ) {
453 + function wppb_paid_plugin_load_updater() {
454 +
455 + if ( class_exists( 'WPPB_Plugin_Updater', false ) )
456 + return;
457 +
458 + if ( ! function_exists( 'wppb_paid_plugin_owns_updates' ) || ! wppb_paid_plugin_owns_updates() )
459 + return;
460 +
461 + require_once WPPB_PAID_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php';
462 +
463 + }
464 +}
465 +
466 +add_action( 'plugins_loaded', 'wppb_paid_plugin_load_updater', 0 );
467 +
468 +// Needs to be loaded early for Upload fields to work correctly
469 +if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php' ) )
470 + include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php' );
471 +
472 +// This needs to be loaded here since we try to plug some functions, not suited for plugins_loaded hook
473 +if ( file_exists( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ) )
474 + include_once( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' );
475 +
476 +/* add a redirect when plugin is activated */
477 +if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
478 + function wppb_activate_plugin_redirect( $plugin ) {
479 + if( !wp_doing_ajax() && $plugin == plugin_basename( __FILE__ ) ) {
480 + wp_safe_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) );
481 + exit();
482 + }
483 + }
484 + add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
485 +}
486 +
487 +/**
488 + * Check if Setup Wizard should run
489 + *
490 + */
491 +function wppb_set_setup_wizard_transient() {
492 +
493 + $slugs = array(
494 + '/profile-builder-pro/index.php',
495 + '/profile-builder-dev/index.php',
496 + '/profile-builder-agency/index.php',
497 + '/profile-builder-unlimited/index.php',
498 + '/profile-builder-hobbyist/index.php',
499 + '/metronet-profile-picture/metronet-profile-picture.php',
500 + '/user-profile-picture-dev/metronet-profile-picture.php',
501 + '/user-profile-picture/metronet-profile-picture.php',
502 + );
503 +
504 + $paid_plugin_active = false;
505 +
506 + foreach( $slugs as $slug ){
507 + if( file_exists( WP_PLUGIN_DIR . $slug ) ){
508 + $paid_plugin_active = true;
509 + break;
510 + }
511 + }
512 +
513 + // Run Setup Wizard ?
514 + if ( !$paid_plugin_active )
515 + set_transient( 'wppb_run_setup_wizard', 'true', 120 );
516 +
517 + do_action( 'wppb_register_activation_hook' );
518 +
519 +}
520 +register_activation_hook( __FILE__, 'wppb_set_setup_wizard_transient' );
521 +
522 +function wppb_register_deactivation_hook() {
523 + do_action( 'wppb_register_deactivation_hook' );
524 +}
525 +register_deactivation_hook( __FILE__, 'wppb_register_deactivation_hook' );