| @@ -2,16 +2,18 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Profile Builder |
| 4 | 4 | * Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/ |
| 5 | 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.8 | |
| 6 | + * Version: 4.0.3 | |
| 7 | 7 | * Author: Cozmoslabs |
| 8 | 8 | * Author URI: https://www.cozmoslabs.com/ |
| 9 | 9 | * Text Domain: profile-builder |
| 10 | 10 | * Domain Path: /translation |
| 11 | 11 | * License: GPL2 |
| 12 | - * Elementor tested up to: 3.15.1 | |
| 13 | - * Elementor Pro tested up to: 3.15.1 | |
| 12 | + * WC requires at least: 3.0.0 | |
| 13 | + * WC tested up to: 11.1 | |
| 14 | + * Elementor tested up to: 4.3.0 | |
| 15 | + * Elementor Pro tested up to: 4.3.0 | |
| 14 | 16 | * |
| 15 | 17 | * == Copyright == |
| 16 | 18 | * Copyright 2014 Cozmoslabs (www.cozmoslabs.com) |
| 17 | 19 | * |
| @@ -103,19 +105,25 @@ | ||
| 103 | 105 | include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php'); |
| 104 | 106 | include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php'); |
| 105 | 107 | include_once(WPPB_PLUGIN_DIR . '/features/functions.php'); |
| 106 | 108 | include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php'); |
| 109 | + include_once(WPPB_PLUGIN_DIR . '/admin/setup-wizard.php'); | |
| 110 | + include_once(WPPB_PLUGIN_DIR . '/admin/dashboard.php'); | |
| 107 | 111 | include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php'); |
| 108 | 112 | include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php'); |
| 109 | 113 | include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php'); |
| 110 | - include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php'); | |
| 111 | 114 | include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php'); |
| 112 | 115 | include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php'); |
| 113 | 116 | include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php'); |
| 117 | + include_once(WPPB_PLUGIN_DIR . '/admin/support-chat.php'); | |
| 114 | 118 | //include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7 |
| 115 | 119 | include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php'); |
| 116 | 120 | include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php'); |
| 117 | 121 | |
| 122 | + if( file_exists( WPPB_PLUGIN_DIR . '/admin/plugin-optin/class-plugin-optin.php' ) ){ | |
| 123 | + include_once( WPPB_PLUGIN_DIR . '/admin/plugin-optin/class-plugin-optin.php' ); | |
| 124 | + } | |
| 125 | + | |
| 118 | 126 | if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php' ) ) { |
| 119 | 127 | include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php'); |
| 120 | 128 | include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php'); |
| 121 | 129 | } |
| @@ -123,8 +131,16 @@ | ||
| 123 | 131 | if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php' ) ) { |
| 124 | 132 | include_once(WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php'); |
| 125 | 133 | } |
| 126 | 134 | |
| 135 | + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/color-switcher.php' ) ) { | |
| 136 | + include_once( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/color-switcher.php' ); | |
| 137 | + } | |
| 138 | + | |
| 139 | + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/ajax/ajax-functions.php' ) ) { | |
| 140 | + include_once( WPPB_PAID_PLUGIN_DIR . '/features/ajax/ajax-functions.php' ); | |
| 141 | + } | |
| 142 | + | |
| 127 | 143 | if ( wppb_conditional_fields_exists() ) { |
| 128 | 144 | include_once(WPPB_PAID_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php'); |
| 129 | 145 | } |
| 130 | 146 | |
| @@ -137,21 +153,27 @@ | ||
| 137 | 153 | include_once( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ); |
| 138 | 154 | new WPPB_Two_Factor_Authenticator(); |
| 139 | 155 | } |
| 140 | 156 | |
| 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'); | |
| 157 | + if ( file_exists( WPPB_PLUGIN_DIR . '/admin/register-version.php' ) ) { | |
| 158 | + include_once( WPPB_PLUGIN_DIR . '/admin/register-version.php' ); | |
| 144 | 159 | } |
| 145 | 160 | |
| 161 | + // Forms Rework (free): default forms always; extra forms need paid | |
| 162 | + // (wppb_fb_multiple_forms_available). require_once — silent skip would | |
| 163 | + // break per-form field lists with no error. | |
| 164 | + require_once( WPPB_PLUGIN_DIR . 'form-builder/form-builder-init.php' ); | |
| 165 | + | |
| 146 | 166 | if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) { |
| 147 | 167 | |
| 148 | 168 | 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'); | |
| 169 | + // include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php'); | |
| 150 | 170 | 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 | 171 | include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php'); |
| 153 | 172 | |
| 173 | + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' ) ) | |
| 174 | + include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' ); | |
| 175 | + | |
| 154 | 176 | $wppb_module_settings = get_option('wppb_module_settings'); |
| 155 | 177 | if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) { |
| 156 | 178 | add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode'); |
| 157 | 179 | } else |
| @@ -171,8 +193,19 @@ | ||
| 171 | 193 | |
| 172 | 194 | /* added recaptcha and user role field since version 2.6.2 */ |
| 173 | 195 | 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 | 196 | |
| 197 | + /* added turnstile field since version 3.15. */ | |
| 198 | + include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/turnstile/turnstile.php'); | |
| 199 | + | |
| 200 | + // Elementor PRO | |
| 201 | + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php' ) ) { | |
| 202 | + $active_wp_plugins = get_option('active_plugins'); | |
| 203 | + | |
| 204 | + if ( !empty( $active_wp_plugins ) && in_array( 'elementor-pro/elementor-pro.php', $active_wp_plugins ) ) | |
| 205 | + include_once(WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php'); | |
| 206 | + } | |
| 207 | + | |
| 175 | 208 | //Elementor Widgets |
| 176 | 209 | if ( did_action( 'elementor/loaded' ) ) { |
| 177 | 210 | if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php')) |
| 178 | 211 | include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'; |
| @@ -177,17 +210,27 @@ | ||
| 177 | 210 | if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php')) |
| 178 | 211 | include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'; |
| 179 | 212 | } |
| 180 | 213 | |
| 181 | - //Blocks | |
| 214 | + //Divi Extension | |
| 215 | + if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php')) | |
| 216 | + include_once WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php'; | |
| 217 | + | |
| 218 | + //Block Editor Assets | |
| 182 | 219 | global $wp_version; |
| 183 | 220 | 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'; | |
| 221 | + if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php' ) ) | |
| 222 | + include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php'; | |
| 186 | 223 | } |
| 187 | 224 | |
| 225 | + //Block Content Restriction | |
| 226 | + global $content_restriction_activated; | |
| 227 | + if ( $content_restriction_activated == 'yes' && version_compare( $wp_version, "5.0.0", ">=" ) ) { | |
| 228 | + if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php' ) ) | |
| 229 | + include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php'; | |
| 230 | + } | |
| 231 | + | |
| 188 | 232 | //Elementor Content Restriction |
| 189 | - global $content_restriction_activated; | |
| 190 | 233 | if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) { |
| 191 | 234 | if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) ) |
| 192 | 235 | include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php'; |
| 193 | 236 | } |
| @@ -220,8 +263,13 @@ | ||
| 220 | 263 | if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) ) |
| 221 | 264 | include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php'; |
| 222 | 265 | } |
| 223 | 266 | |
| 267 | + if( isset( $wppb_free_add_ons_settings['user-profile-picture'] ) && $wppb_free_add_ons_settings['user-profile-picture'] ){ | |
| 268 | + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php' ) ) | |
| 269 | + include_once WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php'; | |
| 270 | + } | |
| 271 | + | |
| 224 | 272 | } |
| 225 | 273 | |
| 226 | 274 | //Include Advanced Add-ons |
| 227 | 275 | |
| @@ -249,8 +297,13 @@ | ||
| 249 | 297 | if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php' ) ) |
| 250 | 298 | include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php'; |
| 251 | 299 | } |
| 252 | 300 | |
| 301 | + if( isset( $wppb_advanced_add_ons_settings['form-fields-in-columns'] ) && $wppb_advanced_add_ons_settings['form-fields-in-columns'] ){ | |
| 302 | + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php' ) ) | |
| 303 | + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php'; | |
| 304 | + } | |
| 305 | + | |
| 253 | 306 | if( isset( $wppb_advanced_add_ons_settings['mailchimp-integration'] ) && $wppb_advanced_add_ons_settings['mailchimp-integration'] ){ |
| 254 | 307 | if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php' ) ) |
| 255 | 308 | include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php'; |
| 256 | 309 | } |
| @@ -284,8 +337,13 @@ | ||
| 284 | 337 | if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php' ) ) |
| 285 | 338 | include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php'; |
| 286 | 339 | } |
| 287 | 340 | |
| 341 | + if( isset( $wppb_advanced_add_ons_settings['progress-bar'] ) && $wppb_advanced_add_ons_settings['progress-bar'] ){ | |
| 342 | + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/progress-bar/index.php' ) ) | |
| 343 | + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/progress-bar/index.php'; | |
| 344 | + } | |
| 345 | + | |
| 288 | 346 | } |
| 289 | 347 | |
| 290 | 348 | /** |
| 291 | 349 | * Include add-on files that contain activation hooks even when add-ons are deactivated |
| @@ -306,8 +364,11 @@ | ||
| 306 | 364 | |
| 307 | 365 | if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php') ) |
| 308 | 366 | require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php'; |
| 309 | 367 | |
| 368 | + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php') ) | |
| 369 | + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php'; | |
| 370 | + | |
| 310 | 371 | if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php') ) |
| 311 | 372 | require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php'; |
| 312 | 373 | |
| 313 | 374 | } |
| @@ -312,67 +373,8 @@ | ||
| 312 | 373 | |
| 313 | 374 | } |
| 314 | 375 | |
| 315 | 376 | |
| 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 | 377 | // these settings are important, so besides running them on page load, we also need to do a check on plugin activation |
| 376 | 378 | add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings |
| 377 | 379 | add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list |
| 378 | 380 | |
| @@ -384,9 +386,9 @@ | ||
| 384 | 386 | * Definitions |
| 385 | 387 | * |
| 386 | 388 | * |
| 387 | 389 | */ |
| 388 | -define('PROFILE_BUILDER_VERSION', '3.9.8' ); | |
| 390 | +define('PROFILE_BUILDER_VERSION', '4.0.3' ); | |
| 389 | 391 | define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 390 | 392 | define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 391 | 393 | define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 392 | 394 | define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation'); |
| @@ -396,15 +398,15 @@ | ||
| 396 | 398 | $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); |
| 397 | 399 | $active_network_plugins = get_site_option('active_sitewide_plugins'); |
| 398 | 400 | |
| 399 | 401 | if ( in_array( 'profile-builder-pro/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-pro/index.php'] ) ){ |
| 400 | - | |
| 402 | + | |
| 401 | 403 | define('PROFILE_BUILDER', 'Profile Builder Pro'); |
| 402 | 404 | define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-pro' ); |
| 403 | 405 | define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-pro/' ); |
| 404 | 406 | |
| 405 | 407 | } elseif ( in_array( 'profile-builder-dev/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-dev/index.php'] ) ){ |
| 406 | - | |
| 408 | + | |
| 407 | 409 | define('PROFILE_BUILDER', 'Profile Builder Pro'); |
| 408 | 410 | define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-dev' ); |
| 409 | 411 | define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' ); |
| 410 | 412 | define('PROFILE_BUILDER_PAID_VERSION', 'dev' ); |
| @@ -409,21 +411,21 @@ | ||
| 409 | 411 | define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' ); |
| 410 | 412 | define('PROFILE_BUILDER_PAID_VERSION', 'dev' ); |
| 411 | 413 | |
| 412 | 414 | } elseif ( in_array( 'profile-builder-agency/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-agency/index.php'] ) ){ |
| 413 | - | |
| 415 | + | |
| 414 | 416 | define('PROFILE_BUILDER', 'Profile Builder Agency'); |
| 415 | 417 | define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-agency' ); |
| 416 | 418 | define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-agency/' ); |
| 417 | 419 | |
| 418 | 420 | } elseif ( in_array( 'profile-builder-unlimited/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-unlimited/index.php'] ) ){ |
| 419 | - | |
| 421 | + | |
| 420 | 422 | define('PROFILE_BUILDER', 'Profile Builder Unlimited'); |
| 421 | 423 | define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-unlimited' ); |
| 422 | 424 | define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-unlimited/' ); |
| 423 | 425 | |
| 424 | 426 | } elseif ( in_array( 'profile-builder-hobbyist/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-hobbyist/index.php'] ) ){ |
| 425 | - | |
| 427 | + | |
| 426 | 428 | define('PROFILE_BUILDER', 'Profile Builder Basic'); |
| 427 | 429 | define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-hobbyist' ); |
| 428 | 430 | define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-hobbyist/' ); |
| 429 | 431 | |
| @@ -429,13 +431,48 @@ | ||
| 429 | 431 | |
| 430 | 432 | } else |
| 431 | 433 | define('PROFILE_BUILDER', 'Profile Builder Free'); |
| 432 | 434 | |
| 435 | +if ( ! function_exists( 'wppb_paid_plugin_owns_updates' ) ) { | |
| 436 | + function wppb_paid_plugin_owns_updates() { | |
| 437 | + | |
| 438 | + if ( ! defined( 'WPPB_PAID_PLUGIN_DIR' ) || ! defined( 'WPPB_PLUGIN_DIR' ) ) | |
| 439 | + return false; | |
| 440 | + | |
| 441 | + if ( trailingslashit( WPPB_PAID_PLUGIN_DIR ) === trailingslashit( WPPB_PLUGIN_DIR ) ) | |
| 442 | + return false; | |
| 443 | + | |
| 444 | + return file_exists( WPPB_PAID_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php' ); | |
| 445 | + | |
| 446 | + } | |
| 447 | +} | |
| 448 | + | |
| 449 | +/** | |
| 450 | + * Load the EDD updater from the paid wrapper when it owns updates. | |
| 451 | + */ | |
| 452 | +if ( ! function_exists( 'wppb_paid_plugin_load_updater' ) ) { | |
| 453 | + function wppb_paid_plugin_load_updater() { | |
| 454 | + | |
| 455 | + if ( class_exists( 'WPPB_Plugin_Updater', false ) ) | |
| 456 | + return; | |
| 457 | + | |
| 458 | + if ( ! function_exists( 'wppb_paid_plugin_owns_updates' ) || ! wppb_paid_plugin_owns_updates() ) | |
| 459 | + return; | |
| 460 | + | |
| 461 | + require_once WPPB_PAID_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php'; | |
| 462 | + | |
| 463 | + } | |
| 464 | +} | |
| 465 | + | |
| 466 | +add_action( 'plugins_loaded', 'wppb_paid_plugin_load_updater', 0 ); | |
| 467 | + | |
| 468 | +// Needs to be loaded early for Upload fields to work correctly | |
| 469 | +if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php' ) ) | |
| 470 | + include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php' ); | |
| 471 | + | |
| 433 | 472 | // 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'); | |
| 473 | +if ( file_exists( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ) ) | |
| 474 | + include_once( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ); | |
| 438 | 475 | |
| 439 | 476 | /* add a redirect when plugin is activated */ |
| 440 | 477 | if( !function_exists( 'wppb_activate_plugin_redirect' ) ){ |
| 441 | 478 | function wppb_activate_plugin_redirect( $plugin ) { |
| @@ -445,4 +482,44 @@ | ||
| 445 | 482 | } |
| 446 | 483 | } |
| 447 | 484 | add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' ); |
| 448 | 485 | } |
| 486 | + | |
| 487 | +/** | |
| 488 | + * Check if Setup Wizard should run | |
| 489 | + * | |
| 490 | + */ | |
| 491 | +function wppb_set_setup_wizard_transient() { | |
| 492 | + | |
| 493 | + $slugs = array( | |
| 494 | + '/profile-builder-pro/index.php', | |
| 495 | + '/profile-builder-dev/index.php', | |
| 496 | + '/profile-builder-agency/index.php', | |
| 497 | + '/profile-builder-unlimited/index.php', | |
| 498 | + '/profile-builder-hobbyist/index.php', | |
| 499 | + '/metronet-profile-picture/metronet-profile-picture.php', | |
| 500 | + '/user-profile-picture-dev/metronet-profile-picture.php', | |
| 501 | + '/user-profile-picture/metronet-profile-picture.php', | |
| 502 | + ); | |
| 503 | + | |
| 504 | + $paid_plugin_active = false; | |
| 505 | + | |
| 506 | + foreach( $slugs as $slug ){ | |
| 507 | + if( file_exists( WP_PLUGIN_DIR . $slug ) ){ | |
| 508 | + $paid_plugin_active = true; | |
| 509 | + break; | |
| 510 | + } | |
| 511 | + } | |
| 512 | + | |
| 513 | + // Run Setup Wizard ? | |
| 514 | + if ( !$paid_plugin_active ) | |
| 515 | + set_transient( 'wppb_run_setup_wizard', 'true', 120 ); | |
| 516 | + | |
| 517 | + do_action( 'wppb_register_activation_hook' ); | |
| 518 | + | |
| 519 | +} | |
| 520 | +register_activation_hook( __FILE__, 'wppb_set_setup_wizard_transient' ); | |
| 521 | + | |
| 522 | +function wppb_register_deactivation_hook() { | |
| 523 | + do_action( 'wppb_register_deactivation_hook' ); | |
| 524 | +} | |
| 525 | +register_deactivation_hook( __FILE__, 'wppb_register_deactivation_hook' ); | |