# profile-builder/2.0.4/index.php

User Profile Builder – Beautiful User Registration Forms, User Profiles &amp; User Role Editor, version 2.0.4. 162 lines.

- Page: https://pluginprobe.com/plugins/profile-builder/2.0.4/code/index.php
- Raw: https://pluginprobe.com/plugins/profile-builder/2.0.4/raw/index.php
- Modified: 2014-10-29T10:23:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/profile-builder/2.0.4/code/index.php#L10-L20`.

```php
<?php
/*
Plugin Name: Profile Builder
Plugin URI: http://www.cozmoslabs.com/wordpress-profile-builder/
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.
Version: 2.0.4
Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel
Author URI: http://www.cozmoslabs.com/
License: GPL2

== Copyright ==
Copyright 2014 Cozmoslabs (www.cozmoslabs.com)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

/**
 * Convert memory value from ini file to a readable form
 *
 * @since v.1.0
 *
 * @return integer
 */
function wppb_return_bytes( $val ) {
    $val = trim( $val );
	
    switch( strtolower( $val[strlen( $val )-1] ) ) {
        // The 'G' modifier is available since PHP 5.1.0
        case 'g':
            $val *= 1024;
        case 'm':
            $val *= 1024;
        case 'k':
            $val *= 1024;
    }

    return $val;
}

/**
 * Definitions
 *
 *
 */
define( 'PROFILE_BUILDER_VERSION', '2.0.4' );
define( 'WPPB_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
define( 'WPPB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters( 'wppb_server_max_upload_size_byte_constant', wppb_return_bytes( ini_get( 'upload_max_filesize') ) ) );
define( 'WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA', apply_filters( 'wppb_server_max_upload_size_mega_constant', ini_get( 'upload_max_filesize') ) );
define( 'WPPB_SERVER_MAX_POST_SIZE_BYTE', apply_filters( 'wppb_server_max_post_size_byte_constant', wppb_return_bytes( ini_get( 'post_max_size') ) ) );
define( 'WPPB_SERVER_MAX_POST_SIZE_MEGA', apply_filters( 'wppb_server_max_post_size_mega_constant', ini_get( 'post_max_size') ) );
define( 'WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR.'/translation' );
define( 'WPPB_TRANSLATE_DOMAIN', 'profilebuilder' );

/* include notices class */
if ( file_exists ( WPPB_PLUGIN_DIR.'/assets/lib/class_notices.php' ) )
    include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php' );

if ( file_exists ( WPPB_PLUGIN_DIR.'/modules/modules.php' ) )
	define( 'PROFILE_BUILDER', 'Profile Builder Pro' );
elseif ( file_exists ( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' ) )
	define( 'PROFILE_BUILDER', 'Profile Builder Hobbyist' );
else
	define( 'PROFILE_BUILDER', 'Profile Builder Free' );

/**
 * Initialize the translation for the Plugin.
 *
 * @since v.1.0
 *
 * @return null
 */
function wppb_init_translation(){
	load_plugin_textdomain( 'profilebuilder', false, basename( dirname( __FILE__ ) ) . '/translation/' ); 
}
add_action( 'init', 'wppb_init_translation' );


/**
 * Required files
 *
 *
 */
include_once( WPPB_PLUGIN_DIR.'/assets/lib/wck-api/wordpress-creation-kit.php' );
include_once( WPPB_PLUGIN_DIR.'/features/upgrades/upgrades.php' );
include_once( WPPB_PLUGIN_DIR.'/features/functions.php' );
include_once( WPPB_PLUGIN_DIR.'/admin/admin-functions.php' );
include_once( WPPB_PLUGIN_DIR.'/admin/basic-info.php' );
include_once( WPPB_PLUGIN_DIR.'/admin/general-settings.php' );
include_once( WPPB_PLUGIN_DIR.'/admin/admin-bar.php' );
include_once( WPPB_PLUGIN_DIR.'/admin/manage-fields.php' );
include_once( WPPB_PLUGIN_DIR.'/features/email-confirmation/email-confirmation.php' );
include_once( WPPB_PLUGIN_DIR.'/features/email-confirmation/class-email-confirmation.php' );
if ( file_exists ( WPPB_PLUGIN_DIR.'/features/admin-approval/admin-approval.php' ) ) {
    include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
    include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
}
include_once( WPPB_PLUGIN_DIR.'/features/login-widget/login-widget.php' );

if ( file_exists ( WPPB_PLUGIN_DIR.'/update/update-checker.php' ) ){
	include_once ( WPPB_PLUGIN_DIR.'/update/update-checker.php' );
	include_once ( WPPB_PLUGIN_DIR.'/admin/register-version.php' );
}

if ( file_exists ( WPPB_PLUGIN_DIR.'/modules/modules.php' ) ){
    include_once ( WPPB_PLUGIN_DIR.'/modules/modules.php' );
    include_once ( WPPB_PLUGIN_DIR.'/modules/custom-redirects/custom-redirects.php' );
	include_once ( WPPB_PLUGIN_DIR.'/modules/email-customizer/email-customizer.php' );
	include_once ( WPPB_PLUGIN_DIR.'/modules/multiple-forms/multiple-forms.php' );
	
	$wppb_module_settings = get_option( 'wppb_module_settings' );
	if ( isset( $wppb_module_settings['wppb_userListing'] ) && ( $wppb_module_settings['wppb_userListing'] == 'show' ) ){
		include_once ( WPPB_PLUGIN_DIR.'/modules/user-listing/userlisting.php' );
		add_shortcode( 'wppb-list-users', 'wppb_user_listing_shortcode' );
	}else
		add_shortcode( 'wppb-list-users', 'wppb_list_all_users_display_error' );
	
	if ( isset( $wppb_module_settings['wppb_emailCustomizerAdmin'] ) && ( $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) )
		include_once ( WPPB_PLUGIN_DIR.'/modules/email-customizer/admin-email-customizer.php' );
		
	if ( isset( $wppb_module_settings['wppb_emailCustomizer'] ) && ( $wppb_module_settings['wppb_emailCustomizer'] == 'show' ) )
		include_once ( WPPB_PLUGIN_DIR.'/modules/email-customizer/user-email-customizer.php' );
}


/**
 * Check for updates
 *
 *
 */
if ( file_exists ( WPPB_PLUGIN_DIR.'/update/update-checker.php' ) ){	
	if ( file_exists ( WPPB_PLUGIN_DIR.'/modules/modules.php' ) ){
		$localSerial = get_option( 'wppb_profile_builder_pro_serial' );
		$wppb_update = new wppb_PluginUpdateChecker( 'http://updatemetadata.cozmoslabs.com/?localSerialNumber='.$localSerial.'&uniqueproduct=CLPBP', __FILE__, 'profile-builder-pro-update' );
	
	}else{
		$localSerial = get_option( 'wppb_profile_builder_hobbyist_serial' );
		$wppb_update = new wppb_PluginUpdateChecker( 'http://updatemetadata.cozmoslabs.com/?localSerialNumber='.$localSerial.'&uniqueproduct=CLPBH', __FILE__, 'profile-builder-hobbyist-update' );
	}
}


// these settings are important, so besides running them on page load, we also need to do a check on plugin activation
register_activation_hook( __FILE__, 'wppb_generate_default_settings_defaults' );	//prepoulate general settings
register_activation_hook( __FILE__, 'wppb_prepopulate_fields' );					//prepopulate manage fields list

/* Add a halloween notice */
new WPPB_Add_General_Notices( 'wppb_halloween',
    sprintf( __( '<p style="position:relative;">Halloween treat: 30&#37; OFF on all Profile Builder purchases 29 - 30 -31 October over at %1$swww.cozmslabs.com%2$s Get your discount code! %3$sDismiss%4$s</p>', 'profilebuilder'), "<a href='http://www.cozmoslabs.com/' target='_blank' class='button-primary'>", "</a>", "<a href='". add_query_arg( 'wppb_halloween_dismiss_notification', '0' ) ."' class='wppb-dismiss-notification' style='position: absolute;right: 0;top: 50%;margin-top: -7px;'>", "</a>" ),
    'updated halloween',
    '28 October 2014',
    '1 November 2014' );
```
