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

566 lines 30.3 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.16.1
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: 10.7
14 * Elementor tested up to: 4.0.9
15 * Elementor Pro tested up to: 4.0.9
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 */
32
33 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
34
35 /* Check if another version of Profile Builder is activated, to prevent fatal errors*/
36 function wppb_plugin_init() {
37 if (function_exists('wppb_return_bytes')) {
38 function wppb_admin_notice()
39 {
40 ?>
41 <div class="error">
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>
48 </div>
49 <?php
50 }
51 function wppb_plugin_deactivate() {
52 deactivate_plugins( plugin_basename( __FILE__ ) );
53 unset($_GET['activate']);
54 }
55
56 add_action('admin_notices', 'wppb_admin_notice');
57 add_action( 'admin_init', 'wppb_plugin_deactivate' );
58 } else {
59
60 /**
61 * Convert memory value from ini file to a readable form
62 *
63 * @since v.1.0
64 *
65 * @return integer
66 */
67 function wppb_return_bytes($val)
68 {
69 return wp_convert_hr_to_bytes($val);
70 }
71
72 /* include notices class */
73 if ( file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php') )
74 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
75
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 }
81
82 /**
83 * Initialize the translation for the Plugin.
84 *
85 * @since v.1.0
86 *
87 * @return null
88 */
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/' );
95 }
96
97 add_action('init', 'wppb_init_translation', 8);
98
99
100 /**
101 * Required files
102 *
103 *
104 */
105 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
106 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
107 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
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');
111 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
112 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
113 include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php');
114 include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
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
119 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
120 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.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' );
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
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');
150
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();
155 }
156
157 if (file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php')) {
158 include_once(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php');
159 include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
160 }
161
162 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) {
163
164 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php');
165 // include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php');
166 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php');
167 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/multiple-forms/multiple-forms.php');
168 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php');
169
170 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' ) )
171 include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' );
172
173 $wppb_module_settings = get_option('wppb_module_settings');
174 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
175 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
176 } else
177 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
178
179 }
180
181 // Email Customizer is in free since 3.8.1
182 if( file_exists( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ) ){
183 include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' );
184 include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/admin-email-customizer.php' );
185 include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/user-email-customizer.php' );
186 }
187
188 include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
189 include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
190
191 /* added recaptcha and user role field since version 2.6.2 */
192 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
193
194 /* added turnstile field since version 3.15. */
195 include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/turnstile/turnstile.php');
196
197 // Elementor PRO
198 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php' ) ) {
199 $active_wp_plugins = get_option('active_plugins');
200
201 if ( !empty( $active_wp_plugins ) && in_array( 'elementor-pro/elementor-pro.php', $active_wp_plugins ) )
202 include_once(WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php');
203 }
204
205 //Elementor Widgets
206 if ( did_action( 'elementor/loaded' ) ) {
207 if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'))
208 include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php';
209 }
210
211 //Divi Extension
212 if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php'))
213 include_once WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php';
214
215 //Block Editor Assets
216 global $wp_version;
217 if ( version_compare( $wp_version, "5.0.0", ">=" ) ) {
218 if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php' ) )
219 include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php';
220 }
221
222 //Block Content Restriction
223 global $content_restriction_activated;
224 if ( $content_restriction_activated == 'yes' && version_compare( $wp_version, "5.0.0", ">=" ) ) {
225 if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php' ) )
226 include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php';
227 }
228
229 //Elementor Content Restriction
230 if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) {
231 if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) )
232 include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php';
233 }
234
235 //Include Free Add-ons
236 $wppb_free_add_ons_settings = get_option( 'wppb_free_add_ons_settings', array() );
237 if( !empty( $wppb_free_add_ons_settings ) ){
238
239 if( isset( $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ) && $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ){
240 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php' ) )
241 include_once WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php';
242 }
243
244 if( isset( $wppb_free_add_ons_settings['gdpr-communication-preferences'] ) && $wppb_free_add_ons_settings['gdpr-communication-preferences'] ){
245 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php' ) )
246 include_once WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php';
247 }
248
249 if( isset( $wppb_free_add_ons_settings['import-export'] ) && $wppb_free_add_ons_settings['import-export'] ){
250 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php' ) )
251 include_once WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php';
252 }
253
254 if( isset( $wppb_free_add_ons_settings['labels-edit'] ) && $wppb_free_add_ons_settings['labels-edit'] ){
255 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php' ) )
256 include_once WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php';
257 }
258
259 if( isset( $wppb_free_add_ons_settings['maximum-character-length'] ) && $wppb_free_add_ons_settings['maximum-character-length'] ){
260 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) )
261 include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php';
262 }
263
264 if( isset( $wppb_free_add_ons_settings['user-profile-picture'] ) && $wppb_free_add_ons_settings['user-profile-picture'] ){
265 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php' ) )
266 include_once WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php';
267 }
268
269 }
270
271 //Include Advanced Add-ons
272
273 if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){
274
275 $wppb_advanced_add_ons_settings = get_option( 'wppb_advanced_add_ons_settings', array() );
276 if( !empty( $wppb_advanced_add_ons_settings ) ){
277
278 if( isset( $wppb_advanced_add_ons_settings['buddypress'] ) && $wppb_advanced_add_ons_settings['buddypress'] ){
279 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php' ) )
280 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php';
281 }
282
283 if( isset( $wppb_advanced_add_ons_settings['social-connect'] ) && $wppb_advanced_add_ons_settings['social-connect'] ){
284 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php' ) )
285 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php';
286 }
287
288 if( isset( $wppb_advanced_add_ons_settings['woocommerce'] ) && $wppb_advanced_add_ons_settings['woocommerce'] ){
289 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php' ) )
290 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php';
291 }
292
293 if( isset( $wppb_advanced_add_ons_settings['multi-step-forms'] ) && $wppb_advanced_add_ons_settings['multi-step-forms'] ){
294 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php' ) )
295 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php';
296 }
297
298 if( isset( $wppb_advanced_add_ons_settings['form-fields-in-columns'] ) && $wppb_advanced_add_ons_settings['form-fields-in-columns'] ){
299 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php' ) )
300 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php';
301 }
302
303 if( isset( $wppb_advanced_add_ons_settings['mailchimp-integration'] ) && $wppb_advanced_add_ons_settings['mailchimp-integration'] ){
304 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php' ) )
305 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php';
306 }
307
308 if( isset( $wppb_advanced_add_ons_settings['bbpress'] ) && $wppb_advanced_add_ons_settings['bbpress'] ){
309 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php' ) )
310 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php';
311 }
312
313 if( isset( $wppb_advanced_add_ons_settings['campaign-monitor'] ) && $wppb_advanced_add_ons_settings['campaign-monitor'] ){
314 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php' ) )
315 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php';
316 }
317
318 if( isset( $wppb_advanced_add_ons_settings['field-visibility'] ) && $wppb_advanced_add_ons_settings['field-visibility'] ){
319 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php' ) )
320 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php';
321 }
322
323 if( isset( $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ) && $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ){
324 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php' ) )
325 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php';
326 }
327
328 if( isset( $wppb_advanced_add_ons_settings['custom-profile-menus'] ) && $wppb_advanced_add_ons_settings['custom-profile-menus'] ){
329 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php' ) )
330 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php';
331 }
332
333 if( isset( $wppb_advanced_add_ons_settings['mailpoet-integration'] ) && $wppb_advanced_add_ons_settings['mailpoet-integration'] ){
334 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php' ) )
335 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php';
336 }
337
338 }
339
340 /**
341 * Include add-on files that contain activation hooks even when add-ons are deactivated
342 *
343 * Necessary in order to perform actions during the operation of activation or deactivation of that add-on
344 */
345 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php') )
346 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php';
347
348 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php') )
349 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php';
350
351 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php') )
352 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php';
353
354 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php') )
355 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php';
356
357 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php') )
358 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php';
359
360 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php') )
361 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php';
362
363 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php') )
364 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php';
365
366 }
367
368
369 /**
370 * Add explanatory message on the plugins page when updates are not available
371 *
372 */
373 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php') ) {
374
375 if ( class_exists('WPPB_EDD_SL_Plugin_Updater') ) {
376
377 $serial = wppb_get_serial_number();
378
379 if( ! function_exists('get_plugin_data') ){
380 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
381 }
382
383 $plugin_data = get_plugin_data( WPPB_PAID_PLUGIN_DIR . '/index.php', false, false );
384 $pb_plugin_version = ( $plugin_data && $plugin_data['Version'] ) ? $plugin_data['Version'] : '3.7.6' ;
385
386 if( PROFILE_BUILDER == 'Profile Builder Pro' )
387 $pb_cl_plugin_id = '30695';
388 else if( PROFILE_BUILDER == 'Profile Builder Basic' )
389 $pb_cl_plugin_id = '30697';
390 else if( PROFILE_BUILDER == 'Profile Builder Agency' )
391 $pb_cl_plugin_id = '416191';
392 else if( PROFILE_BUILDER == 'Profile Builder Unlimited' )
393 $pb_cl_plugin_id = '30699';
394
395 // setup the updater
396 $wppb_edd_updater = new WPPB_EDD_SL_Plugin_Updater('https://cozmoslabs.com', WPPB_PAID_PLUGIN_DIR . '/index.php', array(
397 'version' => $pb_plugin_version, // current version number
398 'license' => $serial,
399 'item_name' => PROFILE_BUILDER, // name of this plugin
400 'item_id' => $pb_cl_plugin_id,
401 'author' => 'Cozmoslabs', // author of this plugin
402 'beta' => false
403 )
404 );
405
406 }
407
408 function wppb_plugin_update_message( $plugin_data, $new_data ) {
409
410 $wppb_profile_builder_serial = wppb_get_serial_number();
411 $wppb_profile_builder_serial_status = wppb_get_serial_number_status();
412
413 if( empty( $wppb_profile_builder_serial ) ){
414
415 echo '<br />' . wp_kses_post( sprintf( __('To enable updates, please enter your license key on the %sSettings%s page. If you don\'t have a license key, you can %sbuy one now%s.', 'profile-builder' ), '<a href="'.esc_url( admin_url('admin.php?page=profile-builder-general-settings') ).'">', '</a>', '<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=license-updates-disabled-notification&utm_campaign=PBPro#pricing" target="_blank">', '</a>' ) );
416
417 } else if( $wppb_profile_builder_serial_status == 'expired' ) {
418
419 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/?utm_source=wpbackend&utm_medium=clientsite&utm_content=license-updates-disabled-notification&utm_campaign=PBPro' ) );
420
421 } else if ( $wppb_profile_builder_serial_status != 'valid' ) {
422
423 echo '<br />' . wp_kses_post( sprintf( __('To enable updates, you need an active license. %1$sRenew%2$s or %3$spurchase a new license%4$s.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/account/?utm_source=wpbackend&utm_medium=clientsite&utm_content=license-updates-disabled-notification&utm_campaign=PBPro" target="_blank">', '</a>', '<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=license-updates-disabled-notification&utm_campaign=PBPro#pricing" target="_blank">', '</a>' ) );
424
425 }
426
427 }
428 add_action( 'in_plugin_update_message-' . strtolower( str_replace( ' ', '-', PROFILE_BUILDER ) ) . '/index.php', 'wppb_plugin_update_message', 10, 2 );
429 }
430
431
432 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
433 add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
434 add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
435
436 }
437 } //end wppb_plugin_init
438 add_action( 'plugins_loaded', 'wppb_plugin_init' );
439
440 /**
441 * Definitions
442 *
443 *
444 */
445 define('PROFILE_BUILDER_VERSION', '3.16.1' );
446 define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
447 define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
448 define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
449 define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
450 define('WPPB_TRANSLATE_DOMAIN', 'profile-builder');
451
452 // Determine which plugin version is active
453 $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
454 $active_network_plugins = get_site_option('active_sitewide_plugins');
455
456 if ( in_array( 'profile-builder-pro/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-pro/index.php'] ) ){
457
458 define('PROFILE_BUILDER', 'Profile Builder Pro');
459 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-pro' );
460 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-pro/' );
461
462 } elseif ( in_array( 'profile-builder-dev/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-dev/index.php'] ) ){
463
464 define('PROFILE_BUILDER', 'Profile Builder Pro');
465 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-dev' );
466 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' );
467 define('PROFILE_BUILDER_PAID_VERSION', 'dev' );
468
469 } elseif ( in_array( 'profile-builder-agency/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-agency/index.php'] ) ){
470
471 define('PROFILE_BUILDER', 'Profile Builder Agency');
472 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-agency' );
473 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-agency/' );
474
475 } elseif ( in_array( 'profile-builder-unlimited/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-unlimited/index.php'] ) ){
476
477 define('PROFILE_BUILDER', 'Profile Builder Unlimited');
478 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-unlimited' );
479 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-unlimited/' );
480
481 } elseif ( in_array( 'profile-builder-hobbyist/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-hobbyist/index.php'] ) ){
482
483 define('PROFILE_BUILDER', 'Profile Builder Basic');
484 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-hobbyist' );
485 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-hobbyist/' );
486
487 } else
488 define('PROFILE_BUILDER', 'Profile Builder Free');
489
490 // Needs to be loaded early for Upload fields to work correctly
491 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' ) )
492 include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php' );
493
494 // This needs to be loaded here since we try to plug some functions, not suited for plugins_loaded hook
495 if ( file_exists( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ) )
496 include_once( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' );
497
498 /* add a redirect when plugin is activated */
499 if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
500 function wppb_activate_plugin_redirect( $plugin ) {
501 if( !wp_doing_ajax() && $plugin == plugin_basename( __FILE__ ) ) {
502 wp_safe_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) );
503 exit();
504 }
505 }
506 add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
507 }
508
509 add_action( 'wppb_register_activation_hook', 'wppb_activation_deactivation_hook_callback' );
510 add_action( 'wppb_register_deactivation_hook', 'wppb_activation_deactivation_hook_callback' );
511 function wppb_activation_deactivation_hook_callback() {
512
513 if( !function_exists( 'wppb_field_format' ) ){
514 include_once( WPPB_PLUGIN_DIR . '/admin/admin-functions.php' );
515 }
516
517 $current_action = current_action();
518
519 if( $current_action == 'wppb_register_activation_hook' && function_exists( 'wppb_handle_plugin_activation' ) ){
520 wppb_handle_plugin_activation();
521 } else if( $current_action == 'wppb_register_deactivation_hook' && function_exists( 'wppb_handle_plugin_deactivation' ) ){
522 wppb_handle_plugin_deactivation();
523 }
524
525 }
526
527 /**
528 * Check if Setup Wizard should run
529 *
530 */
531 function wppb_set_setup_wizard_transient() {
532
533 $slugs = array(
534 '/profile-builder-pro/index.php',
535 '/profile-builder-dev/index.php',
536 '/profile-builder-agency/index.php',
537 '/profile-builder-unlimited/index.php',
538 '/profile-builder-hobbyist/index.php',
539 '/metronet-profile-picture/metronet-profile-picture.php',
540 '/user-profile-picture-dev/metronet-profile-picture.php',
541 '/user-profile-picture/metronet-profile-picture.php',
542 );
543
544 $paid_plugin_active = false;
545
546 foreach( $slugs as $slug ){
547 if( file_exists( WP_PLUGIN_DIR . $slug ) ){
548 $paid_plugin_active = true;
549 break;
550 }
551 }
552
553 // Run Setup Wizard ?
554 if ( !$paid_plugin_active )
555 set_transient( 'wppb_run_setup_wizard', 'true', 120 );
556
557 do_action( 'wppb_register_activation_hook' );
558
559 }
560 register_activation_hook( __FILE__, 'wppb_set_setup_wizard_transient' );
561
562 function wppb_register_deactivation_hook() {
563 do_action( 'wppb_register_deactivation_hook' );
564 }
565 register_deactivation_hook( __FILE__, 'wppb_register_deactivation_hook' );
566