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

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

216 lines 10.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: 2.8.5
7 Author: Cozmoslabs
8 Author URI: https://www.cozmoslabs.com/
9 Text Domain: profile-builder
10 Domain Path: /translation
11 License: GPL2
12
13 == Copyright ==
14 Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
15
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version.
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29 /* Check if another version of Profile Builder is activated, to prevent fatal errors*/
30 function wppb_free_plugin_init() {
31 if (function_exists('wppb_return_bytes')) {
32 function wppb_admin_notice()
33 {
34 ?>
35 <div class="error">
36 <p><?php printf( __( '%s is also activated. You need to deactivate it before activating this version of the plugin.', 'profile-builder'), PROFILE_BUILDER ); ?></p>
37 </div>
38 <?php
39 }
40 function wppb_plugin_deactivate() {
41 deactivate_plugins( plugin_basename( __FILE__ ) );
42 unset($_GET['activate']);
43 }
44
45 add_action('admin_notices', 'wppb_admin_notice');
46 add_action( 'admin_init', 'wppb_plugin_deactivate' );
47 } else {
48
49 /**
50 * Convert memory value from ini file to a readable form
51 *
52 * @since v.1.0
53 *
54 * @return integer
55 */
56 function wppb_return_bytes($val)
57 {
58 $val = trim($val);
59
60 switch (strtolower($val[strlen($val) - 1])) {
61 // The 'G' modifier is available since PHP 5.1.0
62 case 'g':
63 $val = intval($val) * 1024;
64 case 'm':
65 $val = intval($val) * 1024;
66 case 'k':
67 $val = intval($val) * 1024;
68 }
69
70 return $val;
71 }
72
73 /**
74 * Definitions
75 *
76 *
77 */
78 define('PROFILE_BUILDER_VERSION', '2.8.5' );
79 define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
80 define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
81 define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
82 define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
83 define('WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA', apply_filters('wppb_server_max_upload_size_mega_constant', ini_get('upload_max_filesize')));
84 define('WPPB_SERVER_MAX_POST_SIZE_BYTE', apply_filters('wppb_server_max_post_size_byte_constant', wppb_return_bytes(ini_get('post_max_size'))));
85 define('WPPB_SERVER_MAX_POST_SIZE_MEGA', apply_filters('wppb_server_max_post_size_mega_constant', ini_get('post_max_size')));
86 define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
87 define('WPPB_TRANSLATE_DOMAIN', 'profile-builder');
88
89 /* include notices class */
90 if (file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php'))
91 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
92
93 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php'))
94 define('PROFILE_BUILDER', 'Profile Builder Pro');
95 elseif (file_exists(WPPB_PLUGIN_DIR . '/front-end/extra-fields/extra-fields.php'))
96 define('PROFILE_BUILDER', 'Profile Builder Hobbyist');
97 else
98 define('PROFILE_BUILDER', 'Profile Builder Free');
99
100 /**
101 * Initialize the translation for the Plugin.
102 *
103 * @since v.1.0
104 *
105 * @return null
106 */
107 function wppb_init_translation()
108 {
109 $current_theme = wp_get_theme();
110 if( !empty( $current_theme->stylesheet ) && file_exists( get_theme_root().'/'. $current_theme->stylesheet .'/local_pb_lang' ) )
111 load_plugin_textdomain( 'profile-builder', false, basename( dirname( __FILE__ ) ).'/../../themes/'.$current_theme->stylesheet.'/local_pb_lang' );
112 else
113 load_plugin_textdomain( 'profile-builder', false, basename(dirname(__FILE__)) . '/translation/' );
114 }
115
116 add_action('init', 'wppb_init_translation', 8);
117
118
119 /**
120 * Required files
121 *
122 *
123 */
124 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
125 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
126 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
127 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
128 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
129 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
130 include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php');
131 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
132 include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
133 include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');
134 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
135 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
136 if (file_exists(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php')) {
137 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
138 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
139 }
140 if (file_exists(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php')) {
141 include_once(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
142 }
143 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
144 include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php');
145 include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php');
146
147 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
148 include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
149 include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
150 }
151
152 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
153 include_once(WPPB_PLUGIN_DIR . '/modules/modules.php');
154 include_once(WPPB_PLUGIN_DIR . '/modules/repeater-field/repeater-module.php');
155 include_once(WPPB_PLUGIN_DIR . '/modules/custom-redirects/custom-redirects.php');
156 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/email-customizer.php');
157 include_once(WPPB_PLUGIN_DIR . '/modules/multiple-forms/multiple-forms.php');
158 include_once(WPPB_PLUGIN_DIR . '/modules/user-listing/userlisting.php');
159
160 $wppb_module_settings = get_option('wppb_module_settings');
161 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
162 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
163 } else
164 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
165
166 if (isset($wppb_module_settings['wppb_emailCustomizerAdmin']) && ($wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show'))
167 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/admin-email-customizer.php');
168
169 if (isset($wppb_module_settings['wppb_emailCustomizer']) && ($wppb_module_settings['wppb_emailCustomizer'] == 'show'))
170 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/user-email-customizer.php');
171 }
172
173 include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
174 include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
175
176 /* added recaptcha and user role field since version 2.6.2 */
177 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
178
179
180 /**
181 * Check for updates
182 *
183 *
184 */
185 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
186 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
187 $localSerial = get_option('wppb_profile_builder_pro_serial');
188 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', __FILE__, 'profile-builder-pro-update');
189
190 } else {
191 $localSerial = get_option('wppb_profile_builder_hobbyist_serial');
192 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', __FILE__, 'profile-builder-hobbyist-update');
193 }
194 }
195
196
197 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
198 add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
199 add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
200
201 }
202 } //end wppb_free_plugin_init
203 add_action( 'plugins_loaded', 'wppb_free_plugin_init' );
204
205 if (file_exists( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php'))
206 include_once( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php');
207
208 /* add a redirect when plugin is activated */
209 if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
210 function wppb_activate_plugin_redirect( $plugin ) {
211 if( $plugin == plugin_basename( __FILE__ ) ) {
212 exit( wp_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) ) );
213 }
214 }
215 add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
216 }