PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.0.7
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.0.7
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 2.0.7 All 340 releases
profile-builder / index.php

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

182 lines 8.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: 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.7
7 Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel
8 Author URI: http://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.', 'profilebuilder'); ?></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.0.7' );
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 /* 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 load_plugin_textdomain('profilebuilder', false, basename(dirname(__FILE__)) . '/translation/');
107 }
108
109 add_action('init', 'wppb_init_translation', 8);
110
111
112 /**
113 * Required files
114 *
115 *
116 */
117 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
118 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
119 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
120 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
121 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
122 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
123 include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php');
124 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
125 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
126 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');
130 }
131 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
132
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');
136 }
137
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');
143
144 $wppb_module_settings = get_option('wppb_module_settings');
145 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 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
148 } else
149 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
150
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');
153
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');
156 }
157
158
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');
168
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');
172 }
173 }
174
175
176 // 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
179
180 }
181 } //end wppb_free_plugin_init
182 add_action( 'plugins_loaded', 'wppb_free_plugin_init' );