| 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.9.6 |
| 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.14.0 |
| 13 |
* Elementor Pro tested up to: 3.14.0 |
| 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 ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php' ) ) { |
| 124 |
include_once(WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php'); |
| 125 |
} |
| 126 |
|
| 127 |
if ( wppb_conditional_fields_exists() ) { |
| 128 |
include_once(WPPB_PAID_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php'); |
| 129 |
} |
| 130 |
|
| 131 |
include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php'); |
| 132 |
include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php'); |
| 133 |
include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php'); |
| 134 |
|
| 135 |
/* include 2fa class */ |
| 136 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ) ){ |
| 137 |
include_once( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ); |
| 138 |
new WPPB_Two_Factor_Authenticator(); |
| 139 |
} |
| 140 |
|
| 141 |
if (file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php')) { |
| 142 |
include_once(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php'); |
| 143 |
include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php'); |
| 144 |
} |
| 145 |
|
| 146 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) { |
| 147 |
|
| 148 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php'); |
| 149 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php'); |
| 150 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php'); |
| 151 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/multiple-forms/multiple-forms.php'); |
| 152 |
include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/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 |
} |
| 161 |
|
| 162 |
// Email Customizer is in free since 3.8.1 |
| 163 |
if( file_exists( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ) ){ |
| 164 |
include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ); |
| 165 |
include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/admin-email-customizer.php' ); |
| 166 |
include_once( WPPB_PLUGIN_DIR . '/features/email-customizer/user-email-customizer.php' ); |
| 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 |
//Blocks |
| 182 |
global $wp_version; |
| 183 |
if ( version_compare( $wp_version, "5.0.0", ">=" ) ) { |
| 184 |
if( file_exists( WPPB_PLUGIN_DIR . '/assets/misc/gutenberg-blocks/manage-blocks.php' ) ) |
| 185 |
include_once WPPB_PLUGIN_DIR . '/assets/misc/gutenberg-blocks/manage-blocks.php'; |
| 186 |
} |
| 187 |
|
| 188 |
//Elementor Content Restriction |
| 189 |
global $content_restriction_activated; |
| 190 |
if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) { |
| 191 |
if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) ) |
| 192 |
include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php'; |
| 193 |
} |
| 194 |
|
| 195 |
//Include Free Add-ons |
| 196 |
$wppb_free_add_ons_settings = get_option( 'wppb_free_add_ons_settings', array() ); |
| 197 |
if( !empty( $wppb_free_add_ons_settings ) ){ |
| 198 |
|
| 199 |
if( isset( $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ) && $wppb_free_add_ons_settings['custom-css-classes-on-fields'] ){ |
| 200 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php' ) ) |
| 201 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/custom-css-classes-on-fields/custom-css-classes-on-fields.php'; |
| 202 |
} |
| 203 |
|
| 204 |
if( isset( $wppb_free_add_ons_settings['gdpr-communication-preferences'] ) && $wppb_free_add_ons_settings['gdpr-communication-preferences'] ){ |
| 205 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php' ) ) |
| 206 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/gdpr-communication-preferences/gdpr-communication-preferences.php'; |
| 207 |
} |
| 208 |
|
| 209 |
if( isset( $wppb_free_add_ons_settings['import-export'] ) && $wppb_free_add_ons_settings['import-export'] ){ |
| 210 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php' ) ) |
| 211 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/import-export/import-export.php'; |
| 212 |
} |
| 213 |
|
| 214 |
if( isset( $wppb_free_add_ons_settings['labels-edit'] ) && $wppb_free_add_ons_settings['labels-edit'] ){ |
| 215 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php' ) ) |
| 216 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/labels-edit/labels-edit.php'; |
| 217 |
} |
| 218 |
|
| 219 |
if( isset( $wppb_free_add_ons_settings['maximum-character-length'] ) && $wppb_free_add_ons_settings['maximum-character-length'] ){ |
| 220 |
if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) ) |
| 221 |
include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php'; |
| 222 |
} |
| 223 |
|
| 224 |
} |
| 225 |
|
| 226 |
//Include Advanced Add-ons |
| 227 |
|
| 228 |
if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){ |
| 229 |
|
| 230 |
$wppb_advanced_add_ons_settings = get_option( 'wppb_advanced_add_ons_settings', array() ); |
| 231 |
if( !empty( $wppb_advanced_add_ons_settings ) ){ |
| 232 |
|
| 233 |
if( isset( $wppb_advanced_add_ons_settings['buddypress'] ) && $wppb_advanced_add_ons_settings['buddypress'] ){ |
| 234 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php' ) ) |
| 235 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/index.php'; |
| 236 |
} |
| 237 |
|
| 238 |
if( isset( $wppb_advanced_add_ons_settings['social-connect'] ) && $wppb_advanced_add_ons_settings['social-connect'] ){ |
| 239 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php' ) ) |
| 240 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/social-connect/index.php'; |
| 241 |
} |
| 242 |
|
| 243 |
if( isset( $wppb_advanced_add_ons_settings['woocommerce'] ) && $wppb_advanced_add_ons_settings['woocommerce'] ){ |
| 244 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php' ) ) |
| 245 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/index.php'; |
| 246 |
} |
| 247 |
|
| 248 |
if( isset( $wppb_advanced_add_ons_settings['multi-step-forms'] ) && $wppb_advanced_add_ons_settings['multi-step-forms'] ){ |
| 249 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php' ) ) |
| 250 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php'; |
| 251 |
} |
| 252 |
|
| 253 |
if( isset( $wppb_advanced_add_ons_settings['mailchimp-integration'] ) && $wppb_advanced_add_ons_settings['mailchimp-integration'] ){ |
| 254 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php' ) ) |
| 255 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php'; |
| 256 |
} |
| 257 |
|
| 258 |
if( isset( $wppb_advanced_add_ons_settings['bbpress'] ) && $wppb_advanced_add_ons_settings['bbpress'] ){ |
| 259 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php' ) ) |
| 260 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/bbpress/index.php'; |
| 261 |
} |
| 262 |
|
| 263 |
if( isset( $wppb_advanced_add_ons_settings['campaign-monitor'] ) && $wppb_advanced_add_ons_settings['campaign-monitor'] ){ |
| 264 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php' ) ) |
| 265 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/index.php'; |
| 266 |
} |
| 267 |
|
| 268 |
if( isset( $wppb_advanced_add_ons_settings['field-visibility'] ) && $wppb_advanced_add_ons_settings['field-visibility'] ){ |
| 269 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php' ) ) |
| 270 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/index.php'; |
| 271 |
} |
| 272 |
|
| 273 |
if( isset( $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ) && $wppb_advanced_add_ons_settings['edit-profile-approved-by-admin'] ){ |
| 274 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php' ) ) |
| 275 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/edit-profile-approved-by-admin/index.php'; |
| 276 |
} |
| 277 |
|
| 278 |
if( isset( $wppb_advanced_add_ons_settings['custom-profile-menus'] ) && $wppb_advanced_add_ons_settings['custom-profile-menus'] ){ |
| 279 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php' ) ) |
| 280 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/custom-profile-menus/index.php'; |
| 281 |
} |
| 282 |
|
| 283 |
if( isset( $wppb_advanced_add_ons_settings['mailpoet-integration'] ) && $wppb_advanced_add_ons_settings['mailpoet-integration'] ){ |
| 284 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php' ) ) |
| 285 |
include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php'; |
| 286 |
} |
| 287 |
|
| 288 |
} |
| 289 |
|
| 290 |
/** |
| 291 |
* Include add-on files that contain activation hooks even when add-ons are deactivated |
| 292 |
* |
| 293 |
* Necessary in order to perform actions during the operation of activation or deactivation of that add-on |
| 294 |
*/ |
| 295 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php') ) |
| 296 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/buddypress/buddypress-activator.php'; |
| 297 |
|
| 298 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php') ) |
| 299 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/campaign-monitor/campaign-monitor-activator.php'; |
| 300 |
|
| 301 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php') ) |
| 302 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/field-visibility/field-visibility-activator.php'; |
| 303 |
|
| 304 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php') ) |
| 305 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp/mailchimp-activator.php'; |
| 306 |
|
| 307 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php') ) |
| 308 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php'; |
| 309 |
|
| 310 |
if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php') ) |
| 311 |
require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php'; |
| 312 |
|
| 313 |
} |
| 314 |
|
| 315 |
|
| 316 |
/** |
| 317 |
* Add explanatory message on the plugins page when updates are not available |
| 318 |
* |
| 319 |
*/ |
| 320 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php') ) { |
| 321 |
|
| 322 |
if ( class_exists('WPPB_EDD_SL_Plugin_Updater') ) { |
| 323 |
|
| 324 |
$serial = wppb_get_serial_number(); |
| 325 |
|
| 326 |
if( ! function_exists('get_plugin_data') ){ |
| 327 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 328 |
} |
| 329 |
|
| 330 |
$plugin_data = get_plugin_data( WPPB_PAID_PLUGIN_DIR . '/index.php', false ); |
| 331 |
$pb_plugin_version = ( $plugin_data && $plugin_data['Version'] ) ? $plugin_data['Version'] : '3.7.6' ; |
| 332 |
|
| 333 |
if( PROFILE_BUILDER == 'Profile Builder Pro' ) |
| 334 |
$pb_cl_plugin_id = '30695'; |
| 335 |
else if( PROFILE_BUILDER == 'Profile Builder Basic' ) |
| 336 |
$pb_cl_plugin_id = '30697'; |
| 337 |
else if( PROFILE_BUILDER == 'Profile Builder Agency' ) |
| 338 |
$pb_cl_plugin_id = '416191'; |
| 339 |
else if( PROFILE_BUILDER == 'Profile Builder Unlimited' ) |
| 340 |
$pb_cl_plugin_id = '30699'; |
| 341 |
|
| 342 |
// setup the updater |
| 343 |
$wppb_edd_updater = new WPPB_EDD_SL_Plugin_Updater('https://cozmoslabs.com', WPPB_PAID_PLUGIN_DIR . '/index.php', array( |
| 344 |
'version' => $pb_plugin_version, // current version number |
| 345 |
'license' => $serial, |
| 346 |
'item_name' => PROFILE_BUILDER, // name of this plugin |
| 347 |
'item_id' => $pb_cl_plugin_id, |
| 348 |
'author' => 'Cozmoslabs', // author of this plugin |
| 349 |
'beta' => false |
| 350 |
) |
| 351 |
); |
| 352 |
|
| 353 |
} |
| 354 |
|
| 355 |
function wppb_plugin_update_message( $plugin_data, $new_data ) { |
| 356 |
|
| 357 |
$wppb_profile_builder_serial = wppb_get_serial_number(); |
| 358 |
$wppb_profile_builder_serial_status = wppb_get_serial_number_status(); |
| 359 |
|
| 360 |
if( empty( $wppb_profile_builder_serial ) ){ |
| 361 |
|
| 362 |
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' ) ); |
| 363 |
|
| 364 |
} else if( $wppb_profile_builder_serial_status == 'expired' ) { |
| 365 |
|
| 366 |
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/' ) ); |
| 367 |
|
| 368 |
} |
| 369 |
|
| 370 |
} |
| 371 |
add_action( 'in_plugin_update_message-' . strtolower( str_replace( ' ', '-', PROFILE_BUILDER ) ) . '/index.php', 'wppb_plugin_update_message', 10, 2 ); |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
// these settings are important, so besides running them on page load, we also need to do a check on plugin activation |
| 376 |
add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings |
| 377 |
add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list |
| 378 |
|
| 379 |
} |
| 380 |
} //end wppb_plugin_init |
| 381 |
add_action( 'plugins_loaded', 'wppb_plugin_init' ); |
| 382 |
|
| 383 |
/** |
| 384 |
* Definitions |
| 385 |
* |
| 386 |
* |
| 387 |
*/ |
| 388 |
define('PROFILE_BUILDER_VERSION', '3.9.6' ); |
| 389 |
define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 390 |
define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 391 |
define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 392 |
define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation'); |
| 393 |
define('WPPB_TRANSLATE_DOMAIN', 'profile-builder'); |
| 394 |
|
| 395 |
// Determine which plugin version is active |
| 396 |
$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); |
| 397 |
$active_network_plugins = get_site_option('active_sitewide_plugins'); |
| 398 |
|
| 399 |
if ( in_array( 'profile-builder-pro/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-pro/index.php'] ) ){ |
| 400 |
|
| 401 |
define('PROFILE_BUILDER', 'Profile Builder Pro'); |
| 402 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-pro' ); |
| 403 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-pro/' ); |
| 404 |
|
| 405 |
} elseif ( in_array( 'profile-builder-dev/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-dev/index.php'] ) ){ |
| 406 |
|
| 407 |
define('PROFILE_BUILDER', 'Profile Builder Pro'); |
| 408 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-dev' ); |
| 409 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' ); |
| 410 |
define('PROFILE_BUILDER_PAID_VERSION', 'dev' ); |
| 411 |
|
| 412 |
} elseif ( in_array( 'profile-builder-agency/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-agency/index.php'] ) ){ |
| 413 |
|
| 414 |
define('PROFILE_BUILDER', 'Profile Builder Agency'); |
| 415 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-agency' ); |
| 416 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-agency/' ); |
| 417 |
|
| 418 |
} elseif ( in_array( 'profile-builder-unlimited/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-unlimited/index.php'] ) ){ |
| 419 |
|
| 420 |
define('PROFILE_BUILDER', 'Profile Builder Unlimited'); |
| 421 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-unlimited' ); |
| 422 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-unlimited/' ); |
| 423 |
|
| 424 |
} elseif ( in_array( 'profile-builder-hobbyist/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-hobbyist/index.php'] ) ){ |
| 425 |
|
| 426 |
define('PROFILE_BUILDER', 'Profile Builder Basic'); |
| 427 |
define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-hobbyist' ); |
| 428 |
define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-hobbyist/' ); |
| 429 |
|
| 430 |
} else |
| 431 |
define('PROFILE_BUILDER', 'Profile Builder Free'); |
| 432 |
|
| 433 |
// This needs to be loaded here since we try to plug some functions, not suited for plugins_loaded hook |
| 434 |
if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php')) |
| 435 |
include_once( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php'); |
| 436 |
else if ( file_exists( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ) ) |
| 437 |
include_once( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php'); |
| 438 |
|
| 439 |
/* add a redirect when plugin is activated */ |
| 440 |
if( !function_exists( 'wppb_activate_plugin_redirect' ) ){ |
| 441 |
function wppb_activate_plugin_redirect( $plugin ) { |
| 442 |
if( !wp_doing_ajax() && $plugin == plugin_basename( __FILE__ ) ) { |
| 443 |
wp_safe_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) ); |
| 444 |
exit(); |
| 445 |
} |
| 446 |
} |
| 447 |
add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' ); |
| 448 |
} |
| 449 |
|