| 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.7.5 |
| 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.6.5 |
| 13 |
* Elementor Pro tested up to: 3.6.4 |
| 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/admin-bar.php'); |
| 111 |
include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php'); |
| 112 |
include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php'); |
| 113 |
include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php'); |
| 114 |
//include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7 |
| 115 |
include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php'); |
| 116 |
include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php'); |
| 117 |
|
| 118 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php' ) ) { |
| 119 |
include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php'); |
| 120 |
include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php'); |
| 121 |
} |
| 122 |
|
| 123 |
if ( wppb_conditional_fields_exists() ) { |
| 124 |
include_once(WPPB_PAID_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php'); |
| 125 |
} |
| 126 |
|
| 127 |
include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php'); |
| 128 |
include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php'); |
| 129 |
include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php'); |
| 130 |
|
| 131 |
/* include 2fa class */ |
| 132 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ) ){ |
| 133 |
include_once( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ); |
| 134 |
new WPPB_Two_Factor_Authenticator(); |
| 135 |
} |
| 136 |
|
| 137 |
if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) { |
| 138 |
include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php'); |
| 139 |
include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php'); |
| 140 |
} |
| 141 |
|
| 142 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) { |
| 143 |
|
| 144 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php'); |
| 145 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php'); |
| 146 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php'); |
| 147 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/email-customizer/email-customizer.php'); |
| 148 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/multiple-forms/multiple-forms.php'); |
| 149 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php'); |
| 150 |
|
| 151 |
$wppb_module_settings = get_option('wppb_module_settings'); |
| 152 |
if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) { |
| 153 |
add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode'); |
| 154 |
} else |
| 155 |
add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error'); |
| 156 |
|
| 157 |
$wppb_email_customizer_activate = 'hide'; |
| 158 |
if ( ( !empty( $wppb_module_settings['wppb_emailCustomizer'] ) && $wppb_module_settings['wppb_emailCustomizer'] == 'show' ) || ( !empty( $wppb_module_settings['wppb_emailCustomizerAdmin'] ) && $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) ) |
| 159 |
$wppb_email_customizer_activate = 'show'; |
| 160 |
|
| 161 |
if ( $wppb_email_customizer_activate == 'show' ) |
| 162 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/email-customizer/admin-email-customizer.php'); |
| 163 |
|
| 164 |
if ( $wppb_email_customizer_activate == 'show' ) |
| 165 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/email-customizer/user-email-customizer.php'); |
| 166 |
|
| 167 |
} |
| 168 |
|
| 169 |
include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php'); |
| 170 |
include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php'); |
| 171 |
|
| 172 |
/* added recaptcha and user role field since version 2.6.2 */ |
| 173 |
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 |
| 174 |
|
| 175 |
//Elementor Widgets |
| 176 |
if ( did_action( 'elementor/loaded' ) ) { |
| 177 |
if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php')) |
| 178 |
include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'; |
| 179 |
} |
| 180 |
|
| 181 |
//Elementor Content Restriction |
| 182 |
global $content_restriction_activated; |
| 183 |
if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) { |
| 184 |
if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) ) |
| 185 |
include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php'; |
| 186 |
} |
| 187 |
|
| 188 |
//Include Free Add-ons |
| 189 |
$wppb_free_add_ons_settings = get_option( 'wppb_free_add_ons_settings', array() ); |
| 190 |
if( !empty( $wppb_free_add_ons_settings ) ){ |
| 191 |
|
| 192 |
if( isset( $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ) && $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ){ |
| 193 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php' ) ) |
| 194 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php'; |
| 195 |
} |
| 196 |
|
| 197 |
if( isset( $wppb_free_add_ons_settings['gdpr-communication-preferences'] ) && $wppb_free_add_ons_settings['gdpr-communication-preferences'] ){ |
| 198 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php' ) ) |
| 199 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php'; |
| 200 |
} |
| 201 |
|
| 202 |
if( isset( $wppb_free_add_ons_settings['import-export'] ) && $wppb_free_add_ons_settings['import-export'] ){ |
| 203 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php' ) ) |
| 204 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php'; |
| 205 |
} |
| 206 |
|
| 207 |
if( isset( $wppb_free_add_ons_settings['labels-edit'] ) && $wppb_free_add_ons_settings['labels-edit'] ){ |
| 208 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php' ) ) |
| 209 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php'; |
| 210 |
} |
| 211 |
|
| 212 |
if( isset( $wppb_free_add_ons_settings['maximum-character-length'] ) && $wppb_free_add_ons_settings['maximum-character-length'] ){ |
| 213 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) ) |
| 214 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php'; |
| 215 |
} |
| 216 |
|
| 217 |
} |
| 218 |
|
| 219 |
//Include Advanced Add-ons |
| 220 |
|
| 221 |
if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){ |
| 222 |
|
| 223 |
$wppb_advanced_add_ons_settings = get_option( 'wppb_advanced_add_ons_settings', array() ); |
| 224 |
if( !empty( $wppb_advanced_add_ons_settings ) ){ |
| 225 |
|
| 226 |
if( isset( $wppb_advanced_add_ons_settings['buddypress'] ) && $wppb_advanced_add_ons_settings['buddypress'] ){ |
| 227 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php' ) ) |
| 228 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php'; |
| 229 |
} |
| 230 |
|
| 231 |
if( isset( $wppb_advanced_add_ons_settings['social-connect'] ) && $wppb_advanced_add_ons_settings['social-connect'] ){ |
| 232 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php' ) ) |
| 233 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php'; |
| 234 |
} |
| 235 |
|
| 236 |
if( isset( $wppb_advanced_add_ons_settings['woocommerce'] ) && $wppb_advanced_add_ons_settings['woocommerce'] ){ |
| 237 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php' ) ) |
| 238 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php'; |
| 239 |
} |
| 240 |
|
| 241 |
if( isset( $wppb_advanced_add_ons_settings['multi-step-forms'] ) && $wppb_advanced_add_ons_settings['multi-step-forms'] ){ |
| 242 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php' ) ) |
| 243 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php'; |
| 244 |
} |
| 245 |
|
| 246 |
if( isset( $wppb_advanced_add_ons_settings['mailchimp-integration'] ) && $wppb_advanced_add_ons_settings['mailchimp-integration'] ){ |
| 247 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php' ) ) |
| 248 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php'; |
| 249 |
} |
| 250 |
|
| 251 |
if( isset( $wppb_advanced_add_ons_settings['bbpress'] ) && $wppb_advanced_add_ons_settings['bbpress'] ){ |
| 252 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php' ) ) |
| 253 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php'; |
| 254 |
} |
| 255 |
|
| 256 |
if( isset( $wppb_advanced_add_ons_settings['campaign-monitor'] ) && $wppb_advanced_add_ons_settings['campaign-monitor'] ){ |
| 257 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php' ) ) |
| 258 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php'; |
| 259 |
} |
| 260 |
|
| 261 |
if( isset( $wppb_advanced_add_ons_settings['field-visibility'] ) && $wppb_advanced_add_ons_settings['field-visibility'] ){ |
| 262 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php' ) ) |
| 263 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php'; |
| 264 |
} |
| 265 |
|
| 266 |
if( isset( $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ) && $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ){ |
| 267 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php' ) ) |
| 268 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php'; |
| 269 |
} |
| 270 |
|
| 271 |
if( isset( $wppb_advanced_add_ons_settings['custom-profile-menus'] ) && $wppb_advanced_add_ons_settings['custom-profile-menus'] ){ |
| 272 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php' ) ) |
| 273 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php'; |
| 274 |
} |
| 275 |
|
| 276 |
if( isset( $wppb_advanced_add_ons_settings['mailpoet-integration'] ) && $wppb_advanced_add_ons_settings['mailpoet-integration'] ){ |
| 277 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php' ) ) |
| 278 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php'; |
| 279 |
} |
| 280 |
|
| 281 |
} |
| 282 |
|
| 283 |
/** |
| 284 |
* Include add-on files that contain activation hooks even when add-ons are deactivated |
| 285 |
* |
| 286 |
* Necessary in order to perform actions during the operation of activation or deactivation of that add-on |
| 287 |
*/ |
| 288 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php') ) |
| 289 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php'; |
| 290 |
|
| 291 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php') ) |
| 292 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php'; |
| 293 |
|
| 294 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php') ) |
| 295 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php'; |
| 296 |
|
| 297 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php') ) |
| 298 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php'; |
| 299 |
|
| 300 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php') ) |
| 301 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php'; |
| 302 |
|
| 303 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php') ) |
| 304 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php'; |
| 305 |
|
| 306 |
} |
| 307 |
|
| 308 |
|
| 309 |
/** |
| 310 |
* Check for updates |
| 311 |
* |
| 312 |
* |
| 313 |
*/ |
| 314 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php') ) { |
| 315 |
|
| 316 |
if ( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) |
| 317 |
$localSerial = get_option('wppb_profile_builder_pro_serial'); |
| 318 |
else |
| 319 |
$localSerial = get_option('wppb_profile_builder_hobbyist_serial'); |
| 320 |
|
| 321 |
if( PROFILE_BUILDER == 'Profile Builder Pro' ) |
| 322 |
$wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-pro-update'); |
| 323 |
else if( PROFILE_BUILDER == 'Profile Builder Basic' ) |
| 324 |
$wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-hobbyist-update'); |
| 325 |
else if( PROFILE_BUILDER == 'Profile Builder Elite' ) |
| 326 |
$wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBE', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-elite-update'); |
| 327 |
else if( PROFILE_BUILDER == 'Profile Builder Unlimited' ) |
| 328 |
$wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBL', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-unlimited-update'); |
| 329 |
|
| 330 |
function wppb_plugin_update_message( $plugin_data, $new_data ) { |
| 331 |
|
| 332 |
$wppb_version = file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ? 'pro' : 'hobbyist'; |
| 333 |
|
| 334 |
$wppb_profile_builder_serial = get_option( 'wppb_profile_builder_'.$wppb_version.'_serial' ); |
| 335 |
$wppb_profile_builder_serial_status = get_option( 'wppb_profile_builder_'.$wppb_version.'_serial_status' ); |
| 336 |
|
| 337 |
if( empty( $wppb_profile_builder_serial ) ){ |
| 338 |
|
| 339 |
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' . $wppb_version ) ); |
| 340 |
|
| 341 |
} else if( $wppb_profile_builder_serial_status == 'expired' ) { |
| 342 |
|
| 343 |
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/' ) ); |
| 344 |
|
| 345 |
} |
| 346 |
|
| 347 |
} |
| 348 |
add_action( 'in_plugin_update_message-' . strtolower( str_replace( ' ', '-', PROFILE_BUILDER ) ) . '/index.php', 'wppb_plugin_update_message', 10, 2 ); |
| 349 |
} |
| 350 |
|
| 351 |
|
| 352 |
// these settings are important, so besides running them on page load, we also need to do a check on plugin activation |
| 353 |
add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings |
| 354 |
add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list |
| 355 |
|
| 356 |
} |
| 357 |
} //end wppb_plugin_init |
| 358 |
add_action( 'plugins_loaded', 'wppb_plugin_init' ); |
| 359 |
|
| 360 |
/** |
| 361 |
* Definitions |
| 362 |
* |
| 363 |
* |
| 364 |
*/ |
| 365 |
define('PROFILE_BUILDER_VERSION', '3.7.5' ); |
| 366 |
define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 367 |
define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 368 |
define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 369 |
define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation'); |
| 370 |
define('WPPB_TRANSLATE_DOMAIN', 'profile-builder'); |
| 371 |
|
| 372 |
// Determine which plugin version is active |
| 373 |
$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); |
| 374 |
|
| 375 |
if ( in_array( 'profile-builder-pro/index.php', $active_plugins ) ){ |
| 376 |
|
| 377 |
define('PROFILE_BUILDER', 'Profile Builder Pro'); |
| 378 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-pro' ); |
| 379 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-pro/' ); |
| 380 |
|
| 381 |
} elseif ( in_array( 'profile-builder-dev/index.php', $active_plugins ) ){ |
| 382 |
|
| 383 |
define('PROFILE_BUILDER', 'Profile Builder Pro'); |
| 384 |
define('WPPB_PAID_PLUGIN_DIR', WPPB_PLUGIN_DIR ); |
| 385 |
define('WPPB_PAID_PLUGIN_URL', WPPB_PLUGIN_URL ); |
| 386 |
|
| 387 |
} elseif ( in_array( 'profile-builder-elite/index.php', $active_plugins ) ){ |
| 388 |
|
| 389 |
define('PROFILE_BUILDER', 'Profile Builder Elite'); |
| 390 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-elite' ); |
| 391 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-elite/' ); |
| 392 |
|
| 393 |
} elseif ( in_array( 'profile-builder-unlimited/index.php', $active_plugins ) ){ |
| 394 |
|
| 395 |
define('PROFILE_BUILDER', 'Profile Builder Unlimited'); |
| 396 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-unlimited' ); |
| 397 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-unlimited/' ); |
| 398 |
|
| 399 |
} elseif ( in_array( 'profile-builder-hobbyist/index.php', $active_plugins ) ){ |
| 400 |
|
| 401 |
define('PROFILE_BUILDER', 'Profile Builder Basic'); |
| 402 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-hobbyist' ); |
| 403 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-hobbyist/' ); |
| 404 |
|
| 405 |
} else |
| 406 |
define('PROFILE_BUILDER', 'Profile Builder Free'); |
| 407 |
|
| 408 |
// This needs to be loaded here since we try to plug some functions, not suited for plugins_loaded hook |
| 409 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php')) |
| 410 |
include_once( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php'); |
| 411 |
|
| 412 |
/* add a redirect when plugin is activated */ |
| 413 |
if( !function_exists( 'wppb_activate_plugin_redirect' ) ){ |
| 414 |
function wppb_activate_plugin_redirect( $plugin ) { |
| 415 |
if( !wp_doing_ajax() && $plugin == plugin_basename( __FILE__ ) ) { |
| 416 |
wp_safe_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) ); |
| 417 |
exit(); |
| 418 |
} |
| 419 |
} |
| 420 |
add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' ); |
| 421 |
} |
| 422 |
|