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

199 lines 9.7 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 chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6 Version: 2.5.1
7 Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel, Mihai Iova
8 Author URI: https://www.cozmoslabs.com/
9 License: GPL2
10
11 == Copyright ==
12 Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
13
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 /* Check if another version of Profile Builder is activated, to prevent fatal errors*/
28 function wppb_free_plugin_init() {
29 if (function_exists('wppb_return_bytes')) {
30 function wppb_admin_notice()
31 {
32 ?>
33 <div class="error">
34 <p><?php _e( PROFILE_BUILDER . ' is also activated. You need to deactivate it before activating this version of the plugin.', 'profile-builder'); ?></p>
35 </div>
36 <?php
37 }
38 function wppb_plugin_deactivate() {
39 deactivate_plugins( plugin_basename( __FILE__ ) );
40 unset($_GET['activate']);
41 }
42
43 add_action('admin_notices', 'wppb_admin_notice');
44 add_action( 'admin_init', 'wppb_plugin_deactivate' );
45 } else {
46
47 /**
48 * Convert memory value from ini file to a readable form
49 *
50 * @since v.1.0
51 *
52 * @return integer
53 */
54 function wppb_return_bytes($val)
55 {
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 }
70
71 /**
72 * Definitions
73 *
74 *
75 */
76 define('PROFILE_BUILDER_VERSION', '2.5.1' );
77 define('WPPB_PLUGIN_DIR', plugin_dir_path(__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', 'profile-builder');
85
86 /* include notices class */
87 if (file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php'))
88 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
89
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');
96
97 /**
98 * Initialize the translation for the Plugin.
99 *
100 * @since v.1.0
101 *
102 * @return null
103 */
104 function wppb_init_translation()
105 {
106 $current_theme = wp_get_theme();
107 if( !empty( $current_theme->stylesheet ) && file_exists( get_theme_root().'/'. $current_theme->stylesheet .'/local_pb_lang' ) )
108 load_plugin_textdomain( 'profile-builder', false, basename( dirname( __FILE__ ) ).'/../../themes/'.$current_theme->stylesheet.'/local_pb_lang' );
109 else
110 load_plugin_textdomain( 'profile-builder', false, basename(dirname(__FILE__)) . '/translation/' );
111 }
112
113 add_action('init', 'wppb_init_translation', 8);
114
115
116 /**
117 * Required files
118 *
119 *
120 */
121 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
122 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
123 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
124 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
125 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
126 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
127 include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php');
128 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
129 include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
130 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
131 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
132 if (file_exists(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php')) {
133 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
134 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
135 }
136 if (file_exists(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php')) {
137 include_once(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
138 }
139 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
140
141 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
142 include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
143 include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
144 }
145
146 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
147 include_once(WPPB_PLUGIN_DIR . '/modules/modules.php');
148 include_once(WPPB_PLUGIN_DIR . '/modules/repeater-field/repeater-module.php');
149 include_once(WPPB_PLUGIN_DIR . '/modules/custom-redirects/custom-redirects.php');
150 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/email-customizer.php');
151 include_once(WPPB_PLUGIN_DIR . '/modules/multiple-forms/multiple-forms.php');
152 include_once(WPPB_PLUGIN_DIR . '/modules/user-listing/userlisting.php');
153
154 $wppb_module_settings = get_option('wppb_module_settings');
155 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
156 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
157 } else
158 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
159
160 if (isset($wppb_module_settings['wppb_emailCustomizerAdmin']) && ($wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show'))
161 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/admin-email-customizer.php');
162
163 if (isset($wppb_module_settings['wppb_emailCustomizer']) && ($wppb_module_settings['wppb_emailCustomizer'] == 'show'))
164 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/user-email-customizer.php');
165 }
166
167 include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
168 include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
169 if ( PROFILE_BUILDER != 'Profile Builder Free' )
170 include_once(WPPB_PLUGIN_DIR . '/front-end/extra-fields/recaptcha/recaptcha.php'); //need to load this here for displaying reCAPTCHA on Login and Recover Password forms
171
172
173 /**
174 * Check for updates
175 *
176 *
177 */
178 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
179 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
180 $localSerial = get_option('wppb_profile_builder_pro_serial');
181 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', __FILE__, 'profile-builder-pro-update');
182
183 } else {
184 $localSerial = get_option('wppb_profile_builder_hobbyist_serial');
185 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', __FILE__, 'profile-builder-hobbyist-update');
186 }
187 }
188
189
190 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
191 register_activation_hook(__FILE__, 'wppb_generate_default_settings_defaults'); //prepoulate general settings
192 register_activation_hook(__FILE__, 'wppb_prepopulate_fields'); //prepopulate manage fields list
193
194 }
195 } //end wppb_free_plugin_init
196 add_action( 'plugins_loaded', 'wppb_free_plugin_init' );
197
198 if (file_exists( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php'))
199 include_once( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php');