PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.9
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.9
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
profile-builder / index.php

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

448 lines 24.2 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.9.9
7 * Author: Cozmoslabs
8 * Author URI: https://www.cozmoslabs.com/
9 * Text Domain: profile-builder
10 * Domain Path: /translation
11 * License: GPL2
12 * Elementor tested up to: 3.15.3
13 * Elementor Pro tested up to: 3.15.3
14 *
15 * == Copyright ==
16 * Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
32
33 /* Check if another version of Profile Builder is activated, to prevent fatal errors*/
34 function wppb_plugin_init() {
35 if (function_exists('wppb_return_bytes')) {
36 function wppb_admin_notice()
37 {
38 ?>
39 <div class="error">
40 <p>
41 <?php
42 /* translators: %s is the plugin version name */
43 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 ) );
44 ?>
45 </p>
46 </div>
47 <?php
48 }
49 function wppb_plugin_deactivate() {
50 deactivate_plugins( plugin_basename( __FILE__ ) );
51 unset($_GET['activate']);
52 }
53
54 add_action('admin_notices', 'wppb_admin_notice');
55 add_action( 'admin_init', 'wppb_plugin_deactivate' );
56 } else {
57
58 /**
59 * Convert memory value from ini file to a readable form
60 *
61 * @since v.1.0
62 *
63 * @return integer
64 */
65 function wppb_return_bytes($val)
66 {
67 return wp_convert_hr_to_bytes($val);
68 }
69
70 /* include notices class */
71 if ( file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php') )
72 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
73
74 /* include review class */
75 if (file_exists(WPPB_PLUGIN_DIR . '/admin/review.php')){
76 include_once(WPPB_PLUGIN_DIR . '/admin/review.php');
77 $wppb_review_request = new WPPB_Review_Request ();
78 }
79
80 /**
81 * Initialize the translation for the Plugin.
82 *
83 * @since v.1.0
84 *
85 * @return null
86 */
87 function wppb_init_translation(){
88 $current_theme = wp_get_theme();
89 if( !empty( $current_theme->stylesheet ) && file_exists( get_theme_root().'/'. $current_theme->stylesheet .'/local_pb_lang' ) )
90 load_plugin_textdomain( 'profile-builder', false, basename( dirname( __FILE__ ) ).'/../../themes/'.$current_theme->stylesheet.'/local_pb_lang' );
91 else
92 load_plugin_textdomain( 'profile-builder', false, basename(dirname(__FILE__)) . '/translation/' );
93 }
94
95 add_action('init', 'wppb_init_translation', 8);
96
97
98 /**
99 * Required files
100 *
101 *
102 */
103 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
104 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
105 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
106 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
107 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
108 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
109 include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php');
110 include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
111 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
112 include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
113 //include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7
114 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
115 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
116
117 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php' ) ) {
118 include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
119 include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
120 }
121
122 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php' ) ) {
123 include_once(WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php');
124 }
125
126 if ( wppb_conditional_fields_exists() ) {
127 include_once(WPPB_PAID_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
128 }
129
130 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
131 include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php');
132 include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php');
133
134 /* include 2fa class */
135 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ) ){
136 include_once( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' );
137 new WPPB_Two_Factor_Authenticator();
138 }
139
140 if (file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php')) {
141 include_once(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php');
142 include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
143 }
144
145 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) {
146
147 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php');
148 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php');
149 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php');
150 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/multiple-forms/multiple-forms.php');
151 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php');
152
153 $wppb_module_settings = get_option('wppb_module_settings');
154 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
155 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
156 } else
157 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
158
159 }
160
161 // Email Customizer is in free since 3.8.1
162 if( file_exists( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ) ){
163 include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' );
164 include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/admin-email-customizer.php' );
165 include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/user-email-customizer.php' );
166 }
167
168 include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
169 include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
170
171 /* added recaptcha and user role field since version 2.6.2 */
172 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
173
174 //Elementor Widgets
175 if ( did_action( 'elementor/loaded' ) ) {
176 if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'))
177 include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php';
178 }
179
180 //Blocks
181 global $wp_version;
182 if ( version_compare( $wp_version, "5.0.0", ">=" ) ) {
183 if( file_exists( WPPB_PLUGIN_DIR . '/assets/misc/gutenberg-blocks/manage-blocks.php' ) )
184 include_once WPPB_PLUGIN_DIR . '/assets/misc/gutenberg-blocks/manage-blocks.php';
185 }
186
187 //Elementor Content Restriction
188 global $content_restriction_activated;
189 if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) {
190 if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) )
191 include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php';
192 }
193
194 //Include Free Add-ons
195 $wppb_free_add_ons_settings = get_option( 'wppb_free_add_ons_settings', array() );
196 if( !empty( $wppb_free_add_ons_settings ) ){
197
198 if( isset( $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ) && $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ){
199 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php' ) )
200 include_once WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php';
201 }
202
203 if( isset( $wppb_free_add_ons_settings['gdpr-communication-preferences'] ) && $wppb_free_add_ons_settings['gdpr-communication-preferences'] ){
204 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php' ) )
205 include_once WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php';
206 }
207
208 if( isset( $wppb_free_add_ons_settings['import-export'] ) && $wppb_free_add_ons_settings['import-export'] ){
209 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php' ) )
210 include_once WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php';
211 }
212
213 if( isset( $wppb_free_add_ons_settings['labels-edit'] ) && $wppb_free_add_ons_settings['labels-edit'] ){
214 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php' ) )
215 include_once WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php';
216 }
217
218 if( isset( $wppb_free_add_ons_settings['maximum-character-length'] ) && $wppb_free_add_ons_settings['maximum-character-length'] ){
219 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) )
220 include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php';
221 }
222
223 }
224
225 //Include Advanced Add-ons
226
227 if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){
228
229 $wppb_advanced_add_ons_settings = get_option( 'wppb_advanced_add_ons_settings', array() );
230 if( !empty( $wppb_advanced_add_ons_settings ) ){
231
232 if( isset( $wppb_advanced_add_ons_settings['buddypress'] ) && $wppb_advanced_add_ons_settings['buddypress'] ){
233 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php' ) )
234 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php';
235 }
236
237 if( isset( $wppb_advanced_add_ons_settings['social-connect'] ) && $wppb_advanced_add_ons_settings['social-connect'] ){
238 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php' ) )
239 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php';
240 }
241
242 if( isset( $wppb_advanced_add_ons_settings['woocommerce'] ) && $wppb_advanced_add_ons_settings['woocommerce'] ){
243 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php' ) )
244 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php';
245 }
246
247 if( isset( $wppb_advanced_add_ons_settings['multi-step-forms'] ) && $wppb_advanced_add_ons_settings['multi-step-forms'] ){
248 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php' ) )
249 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php';
250 }
251
252 if( isset( $wppb_advanced_add_ons_settings['mailchimp-integration'] ) && $wppb_advanced_add_ons_settings['mailchimp-integration'] ){
253 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php' ) )
254 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php';
255 }
256
257 if( isset( $wppb_advanced_add_ons_settings['bbpress'] ) && $wppb_advanced_add_ons_settings['bbpress'] ){
258 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php' ) )
259 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php';
260 }
261
262 if( isset( $wppb_advanced_add_ons_settings['campaign-monitor'] ) && $wppb_advanced_add_ons_settings['campaign-monitor'] ){
263 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php' ) )
264 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php';
265 }
266
267 if( isset( $wppb_advanced_add_ons_settings['field-visibility'] ) && $wppb_advanced_add_ons_settings['field-visibility'] ){
268 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php' ) )
269 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php';
270 }
271
272 if( isset( $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ) && $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ){
273 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php' ) )
274 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php';
275 }
276
277 if( isset( $wppb_advanced_add_ons_settings['custom-profile-menus'] ) && $wppb_advanced_add_ons_settings['custom-profile-menus'] ){
278 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php' ) )
279 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php';
280 }
281
282 if( isset( $wppb_advanced_add_ons_settings['mailpoet-integration'] ) && $wppb_advanced_add_ons_settings['mailpoet-integration'] ){
283 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php' ) )
284 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php';
285 }
286
287 }
288
289 /**
290 * Include add-on files that contain activation hooks even when add-ons are deactivated
291 *
292 * Necessary in order to perform actions during the operation of activation or deactivation of that add-on
293 */
294 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php') )
295 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php';
296
297 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php') )
298 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php';
299
300 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php') )
301 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php';
302
303 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php') )
304 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php';
305
306 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php') )
307 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php';
308
309 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php') )
310 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php';
311
312 }
313
314
315 /**
316 * Add explanatory message on the plugins page when updates are not available
317 *
318 */
319 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php') ) {
320
321 if ( class_exists('WPPB_EDD_SL_Plugin_Updater') ) {
322
323 $serial = wppb_get_serial_number();
324
325 if( ! function_exists('get_plugin_data') ){
326 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
327 }
328
329 $plugin_data = get_plugin_data( WPPB_PAID_PLUGIN_DIR . '/index.php', false );
330 $pb_plugin_version = ( $plugin_data && $plugin_data['Version'] ) ? $plugin_data['Version'] : '3.7.6' ;
331
332 if( PROFILE_BUILDER == 'Profile Builder Pro' )
333 $pb_cl_plugin_id = '30695';
334 else if( PROFILE_BUILDER == 'Profile Builder Basic' )
335 $pb_cl_plugin_id = '30697';
336 else if( PROFILE_BUILDER == 'Profile Builder Agency' )
337 $pb_cl_plugin_id = '416191';
338 else if( PROFILE_BUILDER == 'Profile Builder Unlimited' )
339 $pb_cl_plugin_id = '30699';
340
341 // setup the updater
342 $wppb_edd_updater = new WPPB_EDD_SL_Plugin_Updater('https://cozmoslabs.com', WPPB_PAID_PLUGIN_DIR . '/index.php', array(
343 'version' => $pb_plugin_version, // current version number
344 'license' => $serial,
345 'item_name' => PROFILE_BUILDER, // name of this plugin
346 'item_id' => $pb_cl_plugin_id,
347 'author' => 'Cozmoslabs', // author of this plugin
348 'beta' => false
349 )
350 );
351
352 }
353
354 function wppb_plugin_update_message( $plugin_data, $new_data ) {
355
356 $wppb_profile_builder_serial = wppb_get_serial_number();
357 $wppb_profile_builder_serial_status = wppb_get_serial_number_status();
358
359 if( empty( $wppb_profile_builder_serial ) ){
360
361 echo '<br />' . wp_kses_post( sprintf( __('To enable updates, please enter your serial number on the <a href="%s">Register Version</a> page. If you don\'t have a serial number, please see <a href="%s" target="_blank">details & pricing</a>.', 'profile-builder' ), esc_url( admin_url('admin.php?page=profile-builder-register') ), 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=wppb-plugins-page&utm_campaign=WPPB' ) );
362
363 } else if( $wppb_profile_builder_serial_status == 'expired' ) {
364
365 echo '<br />' . wp_kses_post( sprintf( __('To enable updates, your licence needs to be renewed. Please go to the <a href="%s">Cozmoslabs Account</a> page and login to renew.', 'profile-builder' ), 'https://www.cozmoslabs.com/account/' ) );
366
367 }
368
369 }
370 add_action( 'in_plugin_update_message-' . strtolower( str_replace( ' ', '-', PROFILE_BUILDER ) ) . '/index.php', 'wppb_plugin_update_message', 10, 2 );
371 }
372
373
374 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
375 add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
376 add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
377
378 }
379 } //end wppb_plugin_init
380 add_action( 'plugins_loaded', 'wppb_plugin_init' );
381
382 /**
383 * Definitions
384 *
385 *
386 */
387 define('PROFILE_BUILDER_VERSION', '3.9.9' );
388 define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
389 define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
390 define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
391 define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
392 define('WPPB_TRANSLATE_DOMAIN', 'profile-builder');
393
394 // Determine which plugin version is active
395 $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
396 $active_network_plugins = get_site_option('active_sitewide_plugins');
397
398 if ( in_array( 'profile-builder-pro/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-pro/index.php'] ) ){
399
400 define('PROFILE_BUILDER', 'Profile Builder Pro');
401 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-pro' );
402 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-pro/' );
403
404 } elseif ( in_array( 'profile-builder-dev/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-dev/index.php'] ) ){
405
406 define('PROFILE_BUILDER', 'Profile Builder Pro');
407 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-dev' );
408 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' );
409 define('PROFILE_BUILDER_PAID_VERSION', 'dev' );
410
411 } elseif ( in_array( 'profile-builder-agency/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-agency/index.php'] ) ){
412
413 define('PROFILE_BUILDER', 'Profile Builder Agency');
414 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-agency' );
415 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-agency/' );
416
417 } elseif ( in_array( 'profile-builder-unlimited/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-unlimited/index.php'] ) ){
418
419 define('PROFILE_BUILDER', 'Profile Builder Unlimited');
420 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-unlimited' );
421 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-unlimited/' );
422
423 } elseif ( in_array( 'profile-builder-hobbyist/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-hobbyist/index.php'] ) ){
424
425 define('PROFILE_BUILDER', 'Profile Builder Basic');
426 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-hobbyist' );
427 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-hobbyist/' );
428
429 } else
430 define('PROFILE_BUILDER', 'Profile Builder Free');
431
432 // This needs to be loaded here since we try to plug some functions, not suited for plugins_loaded hook
433 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php'))
434 include_once( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php');
435 else if ( file_exists( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ) )
436 include_once( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php');
437
438 /* add a redirect when plugin is activated */
439 if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
440 function wppb_activate_plugin_redirect( $plugin ) {
441 if( !wp_doing_ajax() && $plugin == plugin_basename( __FILE__ ) ) {
442 wp_safe_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) );
443 exit();
444 }
445 }
446 add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
447 }
448