| 1 |
<?php |
| 2 |
/** |
| 3 |
* Function that creates the Manage Fields submenu and populates it with a repeater field form |
| 4 |
* |
| 5 |
* @since v.2.0 |
| 6 |
* |
| 7 |
* @return void |
| 8 |
*/ |
| 9 |
function wppb_manage_fields_submenu(){ |
| 10 |
// create a new sub_menu page which holds the data for the default + extra fields |
| 11 |
$args = array( |
| 12 |
'menu_title' => __( 'Manage Fields', 'profile-builder' ), |
| 13 |
'page_title' => __( 'Manage Default and Extra Fields', 'profile-builder' ), |
| 14 |
'menu_slug' => 'manage-fields', |
| 15 |
'page_type' => 'submenu_page', |
| 16 |
'capability' => 'manage_options', |
| 17 |
'priority' => 5, |
| 18 |
'parent_slug' => 'profile-builder' |
| 19 |
); |
| 20 |
$all_fields = new WCK_Page_Creator_PB( $args ); |
| 21 |
|
| 22 |
|
| 23 |
// populate this page |
| 24 |
$manage_field_types[] = 'Default - Name (Heading)'; |
| 25 |
$manage_field_types[] = 'Default - Contact Info (Heading)'; |
| 26 |
$manage_field_types[] = 'Default - About Yourself (Heading)'; |
| 27 |
$manage_field_types[] = 'Default - Username'; |
| 28 |
$manage_field_types[] = 'Default - First Name'; |
| 29 |
$manage_field_types[] = 'Default - Last Name'; |
| 30 |
$manage_field_types[] = 'Default - Nickname'; |
| 31 |
$manage_field_types[] = 'Default - E-mail'; |
| 32 |
$manage_field_types[] = 'Default - Website'; |
| 33 |
|
| 34 |
// Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 35 |
if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 36 |
$manage_field_types[] = 'Default - AIM'; |
| 37 |
$manage_field_types[] = 'Default - Yahoo IM'; |
| 38 |
$manage_field_types[] = 'Default - Jabber / Google Talk'; |
| 39 |
} |
| 40 |
|
| 41 |
$manage_field_types[] = 'Default - Password'; |
| 42 |
$manage_field_types[] = 'Default - Repeat Password'; |
| 43 |
$manage_field_types[] = 'Default - Biographical Info'; |
| 44 |
$manage_field_types[] = 'Default - Display name publicly as'; |
| 45 |
|
| 46 |
if( PROFILE_BUILDER != 'Profile Builder Free' ) { |
| 47 |
$manage_field_types[] = 'Heading'; |
| 48 |
$manage_field_types[] = 'Input'; |
| 49 |
$manage_field_types[] = 'Input (Hidden)'; |
| 50 |
$manage_field_types[] = 'Textarea'; |
| 51 |
$manage_field_types[] = 'WYSIWYG'; |
| 52 |
$manage_field_types[] = 'Select'; |
| 53 |
$manage_field_types[] = 'Select (Multiple)'; |
| 54 |
$manage_field_types[] = 'Select (Country)'; |
| 55 |
$manage_field_types[] = 'Select (Timezone)'; |
| 56 |
$manage_field_types[] = 'Select (User Role)'; |
| 57 |
$manage_field_types[] = 'Checkbox'; |
| 58 |
$manage_field_types[] = 'Checkbox (Terms and Conditions)'; |
| 59 |
$manage_field_types[] = 'Radio'; |
| 60 |
$manage_field_types[] = 'Upload'; |
| 61 |
$manage_field_types[] = 'Avatar'; |
| 62 |
$manage_field_types[] = 'Datepicker'; |
| 63 |
$manage_field_types[] = 'reCAPTCHA'; |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
//Free to Pro call to action on Manage Fields page |
| 68 |
$field_description = __('Choose one of the supported field types','profile-builder'); |
| 69 |
if( PROFILE_BUILDER == 'Profile Builder Free' ) { |
| 70 |
$field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) ); |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
//user roles |
| 75 |
global $wp_roles; |
| 76 |
|
| 77 |
$user_roles = array(); |
| 78 |
foreach( $wp_roles->roles as $user_role_slug => $user_role ) |
| 79 |
if( $user_role_slug !== 'administrator' ) |
| 80 |
array_push( $user_roles, '%' . $user_role['name'] . '%' . $user_role_slug ); |
| 81 |
|
| 82 |
|
| 83 |
// country select |
| 84 |
$default_country_array = wppb_country_select_options( 'back_end' ); |
| 85 |
foreach( $default_country_array as $iso_country_code => $country_name ) { |
| 86 |
$default_country_values[] = $iso_country_code; |
| 87 |
$default_country_options[] = $country_name; |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
// set up the fields array |
| 92 |
$fields = apply_filters( 'wppb_manage_fields', array( |
| 93 |
|
| 94 |
array( 'type' => 'text', 'slug' => 'field-title', 'title' => __( 'Field Title', 'profile-builder' ), 'description' => __( 'Title of the field', 'profile-builder' ) ), |
| 95 |
array( 'type' => 'select', 'slug' => 'field', 'title' => __( 'Field', 'profile-builder' ), 'options' => apply_filters( 'wppb_manage_fields_types', $manage_field_types ), 'default-option' => true, 'description' => $field_description ), |
| 96 |
array( 'type' => 'text', 'slug' => 'meta-name', 'title' => __( 'Meta-name', 'profile-builder' ), 'default' => wppb_get_meta_name(), 'description' => __( 'Use this in conjuction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be uniqe)<br/>Changing this might take long in case of a very big user-count', 'profile-builder' ) ), |
| 97 |
array( 'type' => 'text', 'slug' => 'id', 'title' => __( 'ID', 'profile-builder' ), 'default' => wppb_get_unique_id(), 'description' => __( "A unique, auto-generated ID for this particular field<br/>You can use this in conjuction with filters to target this element if needed<br/>Can't be edited", 'profile-builder' ), 'readonly' => true ), |
| 98 |
array( 'type' => 'textarea', 'slug' => 'description', 'title' => __( 'Description', 'profile-builder' ), 'description' => __( 'Enter a (detailed) description of the option for end users to read<br/>Optional', 'profile-builder') ), |
| 99 |
array( 'type' => 'text', 'slug' => 'row-count', 'title' => __( 'Row Count', 'profile-builder' ), 'default' => 5, 'description' => __( "Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profile-builder' ) ), |
| 100 |
array( 'type' => 'text', 'slug' => 'allowed-image-extensions', 'title' => __( 'Allowed Image Extensions', 'profile-builder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to: .jpg,.jpeg,.gif,.png (.*)', 'profile-builder' ) ), |
| 101 |
array( 'type' => 'text', 'slug' => 'allowed-upload-extensions', 'title' => __( 'Allowed Upload Extensions', 'profile-builder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all WordPress allowed file extensions (.*)', 'profile-builder' ) ), |
| 102 |
array( 'type' => 'text', 'slug' => 'avatar-size', 'title' => __( 'Avatar Size', 'profile-builder' ), 'default' => 100, 'description' => __( "Enter a value (between 20 and 200) for the size of the 'Avatar'<br/>If not specified, defaults to 100", 'profile-builder' ) ), |
| 103 |
array( 'type' => 'text', 'slug' => 'date-format', 'title' => __( 'Date-format', 'profile-builder' ), 'default' => 'mm/dd/yy', 'description' => __( 'Specify the format of the date when using Datepicker<br/>Valid options: mm/dd/yy, mm/yy/dd, dd/yy/mm, dd/mm/yy, yy/dd/mm, yy/mm/dd<br/>If not specified, defaults to mm/dd/yy', 'profile-builder' ) ), |
| 104 |
array( 'type' => 'textarea', 'slug' => 'terms-of-agreement', 'title' => __( 'Terms of Agreement', 'profile-builder' ), 'description' => __( 'Enter a detailed description of the temrs of agreement for the user to read.<br/>Links can be inserted by using standard HTML syntax: <a href="custom_url">custom_text</a>', 'profile-builder' ) ), |
| 105 |
array( 'type' => 'text', 'slug' => 'options', 'title' => __( 'Options', 'profile-builder' ), 'description' => __( "Enter a comma separated list of values<br/>This can be anything, as it is hidden from the user, but should not contain special characters or apostrophes", 'profile-builder' ) ), |
| 106 |
array( 'type' => 'text', 'slug' => 'labels', 'title' => __( 'Labels', 'profile-builder' ), 'description' => __( "Enter a comma separated list of labels<br/>Visible for the user", 'profile-builder' ) ), |
| 107 |
array( 'type' => 'text', 'slug' => 'public-key', 'title' => __( 'Site Key', 'profile-builder' ), 'description' => __( 'The site key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder' ) ), |
| 108 |
array( 'type' => 'text', 'slug' => 'private-key', 'title' => __( 'Secret Key', 'profile-builder' ), 'description' => __( 'The secret key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder' ) ), |
| 109 |
array( 'type' => 'checkbox', 'slug' => 'captcha-pb-forms', 'title' => __( 'Display on PB forms', 'profile-builder' ), 'options' => array( '%'.__('PB Login','profile-builder').'%'.'pb_login', '%'.__('PB Register','profile-builder').'%'.'pb_register', '%'.__('PB Recover Password','profile-builder').'%'.'pb_recover_password' ), 'default' => 'pb_register', 'description' => __( "Select on which Profile Builder forms to display reCAPTCHA", 'profile-builder' ) ), |
| 110 |
array( 'type' => 'checkbox', 'slug' => 'captcha-wp-forms', 'title' => __( 'Display on default WP forms', 'profile-builder' ), 'options' => array( '%'.__('Default WP Login', 'profile-builder').'%'.'default_wp_login', '%'.__('Default WP Register', 'profile-builder').'%'.'default_wp_register', '%'.__('Default WP Recover Password', 'profile-builder').'%'.'default_wp_recover_password'), 'default' => 'default_wp_register', 'description' => __( "Select on which default WP forms to display reCAPTCHA", 'profile-builder' ) ), |
| 111 |
array( 'type' => 'checkbox', 'slug' => 'user-roles', 'title' => __( 'User Roles', 'profile-builder' ), 'options' => $user_roles, 'description' => __( "Select which user roles to show to the user ( drag and drop to re-order )", 'profile-builder' ) ), |
| 112 |
array( 'type' => 'text', 'slug' => 'user-roles-sort-order', 'title' => __( 'User Roles Order', 'profile-builder' ), 'description' => __( "Save the user role order from the user roles checkboxes", 'profile-builder' ) ), |
| 113 |
array( 'type' => 'text', 'slug' => 'default-value', 'title' => __( 'Default Value', 'profile-builder' ), 'description' => __( "Default value of the field", 'profile-builder' ) ), |
| 114 |
array( 'type' => 'text', 'slug' => 'default-option', 'title' => __( 'Default Option', 'profile-builder' ), 'description' => __( "Specify the option which should be selected by default", 'profile-builder' ) ), |
| 115 |
array( 'type' => 'text', 'slug' => 'default-options', 'title' => __( 'Default Option(s)', 'profile-builder' ), 'description' => __( "Specify the option which should be checked by default<br/>If there are multiple values, separate them with a ',' (comma)", 'profile-builder' ) ), |
| 116 |
array( 'type' => 'select', 'slug' => 'default-option-country', 'title' => __( 'Default Option', 'profile-builder' ), 'values' => ( isset( $default_country_values ) ) ? $default_country_values : '', 'options' => ( isset( $default_country_options ) ) ? $default_country_options : '', 'description' => __( "Default option of the field", 'profile-builder' ) ), |
| 117 |
array( 'type' => 'select', 'slug' => 'default-option-timezone', 'title' => __( 'Default Option', 'profile-builder' ), 'options' => wppb_timezone_select_options( 'back_end' ), 'description' => __( "Default option of the field", 'profile-builder' ) ), |
| 118 |
array( 'type' => 'textarea', 'slug' => 'default-content', 'title' => __( 'Default Content', 'profile-builder' ), 'description' => __( "Default value of the textarea", 'profile-builder' ) ), |
| 119 |
array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profile-builder' ) ), |
| 120 |
array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( "Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder' ) ), |
| 121 |
) ); |
| 122 |
|
| 123 |
// create the new submenu with the above options |
| 124 |
$args = array( |
| 125 |
'metabox_id' => 'manage-fields', |
| 126 |
'metabox_title' => __( 'Field Properties', 'profile-builder' ), |
| 127 |
'post_type' => 'manage-fields', |
| 128 |
'meta_name' => 'wppb_manage_fields', |
| 129 |
'meta_array' => $fields, |
| 130 |
'context' => 'option' |
| 131 |
); |
| 132 |
new Wordpress_Creation_Kit_PB( $args ); |
| 133 |
|
| 134 |
wppb_prepopulate_fields(); |
| 135 |
|
| 136 |
// create the info side meta-box |
| 137 |
$args = array( |
| 138 |
'metabox_id' => 'manage-fields-info', |
| 139 |
'metabox_title' => __( 'Registration & Edit Profile', 'profile-builder' ), |
| 140 |
'post_type' => 'manage-fields', |
| 141 |
'meta_name' => 'wppb_manage_fields_info', |
| 142 |
'meta_array' => '', |
| 143 |
'context' => 'option', |
| 144 |
'mb_context' => 'side' |
| 145 |
); |
| 146 |
new Wordpress_Creation_Kit_PB( $args ); |
| 147 |
} |
| 148 |
add_action( 'init', 'wppb_manage_fields_submenu', 10 ); |
| 149 |
|
| 150 |
/** |
| 151 |
* Function that prepopulates the manage fields list with the default fields of WP |
| 152 |
* |
| 153 |
* @since v.2.0 |
| 154 |
* |
| 155 |
* @return void |
| 156 |
*/ |
| 157 |
function wppb_prepopulate_fields(){ |
| 158 |
$prepopulated_fields[] = array( 'field' => 'Default - Name (Heading)', 'field-title' => __( 'Name', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '1', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 159 |
$prepopulated_fields[] = array( 'field' => 'Default - Username', 'field-title' => __( 'Username', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '2', 'description' => __( 'Usernames cannot be changed.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' ); |
| 160 |
$prepopulated_fields[] = array( 'field' => 'Default - First Name', 'field-title' => __( 'First Name', 'profile-builder' ), 'meta-name' => 'first_name', 'overwrite-existing' => 'No', 'id' => '3', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 161 |
$prepopulated_fields[] = array( 'field' => 'Default - Last Name', 'field-title' => __( 'Last Name', 'profile-builder' ), 'meta-name' => 'last_name', 'overwrite-existing' => 'No', 'id' => '4', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 162 |
$prepopulated_fields[] = array( 'field' => 'Default - Nickname', 'field-title' => __( 'Nickname', 'profile-builder' ), 'meta-name' => 'nickname', 'overwrite-existing' => 'No', 'id' => '5', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' ); |
| 163 |
$prepopulated_fields[] = array( 'field' => 'Default - Display name publicly as', 'field-title' => __( 'Display name publicly as', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '6', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 164 |
$prepopulated_fields[] = array( 'field' => 'Default - Contact Info (Heading)', 'field-title' => __( 'Contact Info', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '7', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 165 |
$prepopulated_fields[] = array( 'field' => 'Default - E-mail', 'field-title' => __( 'E-mail', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '8', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' ); |
| 166 |
$prepopulated_fields[] = array( 'field' => 'Default - Website', 'field-title' => __( 'Website', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '9', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 167 |
|
| 168 |
// Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 169 |
if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 170 |
$prepopulated_fields[] = array( 'field' => 'Default - AIM', 'field-title' => __( 'AIM', 'profile-builder' ), 'meta-name' => 'aim', 'overwrite-existing' => 'No', 'id' => '10', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 171 |
$prepopulated_fields[] = array( 'field' => 'Default - Yahoo IM', 'field-title' => __( 'Yahoo IM', 'profile-builder' ), 'meta-name' => 'yim', 'overwrite-existing' => 'No', 'id' => '11', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 172 |
$prepopulated_fields[] = array( 'field' => 'Default - Jabber / Google Talk', 'field-title' => __( 'Jabber / Google Talk', 'profile-builder' ), 'meta-name' => 'jabber', 'overwrite-existing' => 'No', 'id' => '12', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 173 |
} |
| 174 |
|
| 175 |
$prepopulated_fields[] = array( 'field' => 'Default - About Yourself (Heading)', 'field-title' => __( 'About Yourself', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '13', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); |
| 176 |
$prepopulated_fields[] = array( 'field' => 'Default - Biographical Info', 'field-title' => __( 'Biographical Info', 'profile-builder' ), 'meta-name' => 'description', 'overwrite-existing' => 'No', 'id' => '14', 'description' => __( 'Share a little biographical information to fill out your profile. This may be shown publicly.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'required' => 'No' ); |
| 177 |
$prepopulated_fields[] = array( 'field' => 'Default - Password', 'field-title' => __( 'Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '15', 'description' => __( 'Type your password.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' ); |
| 178 |
$prepopulated_fields[] = array( 'field' => 'Default - Repeat Password', 'field-title' => __( 'Repeat Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '16', 'description' => __( 'Type your password again. ', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' ); |
| 179 |
|
| 180 |
add_option ( 'wppb_manage_fields', apply_filters ( 'wppb_prepopulated_fields', $prepopulated_fields ) ); |
| 181 |
} |
| 182 |
|
| 183 |
/** |
| 184 |
* Function that returns a unique meta-name |
| 185 |
* |
| 186 |
* @since v.2.0 |
| 187 |
* |
| 188 |
* @return string |
| 189 |
*/ |
| 190 |
function wppb_get_meta_name(){ |
| 191 |
$id = 1; |
| 192 |
|
| 193 |
$wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' ); |
| 194 |
|
| 195 |
if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){ |
| 196 |
return 'custom_field_' . $id; |
| 197 |
} |
| 198 |
else{ |
| 199 |
$meta_names = array(); |
| 200 |
foreach( $wppb_manage_fields as $value ){ |
| 201 |
if ( strpos( $value['meta-name'], 'custom_field' ) === 0 ){ |
| 202 |
$meta_names[] = $value['meta-name']; |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
if( !empty( $meta_names ) ){ |
| 207 |
$meta_numbers = array(); |
| 208 |
foreach( $meta_names as $meta_name ){ |
| 209 |
$number = str_replace( 'custom_field', '', $meta_name ); |
| 210 |
/* we should have an underscore present in custom_field_# so remove it */ |
| 211 |
$number = str_replace( '_', '', $number ); |
| 212 |
|
| 213 |
$meta_numbers[] = $number; |
| 214 |
} |
| 215 |
if( !empty( $meta_numbers ) ){ |
| 216 |
rsort( $meta_numbers ); |
| 217 |
$id = $meta_numbers[0]+1; |
| 218 |
} |
| 219 |
} |
| 220 |
|
| 221 |
return 'custom_field_' . $id; |
| 222 |
} |
| 223 |
} |
| 224 |
|
| 225 |
|
| 226 |
/** |
| 227 |
* Function that returns an array with countries |
| 228 |
* |
| 229 |
* @since v.2.0 |
| 230 |
* |
| 231 |
* @return array |
| 232 |
*/ |
| 233 |
function wppb_country_select_options( $form_location ) { |
| 234 |
$country_array = apply_filters( 'wppb_'.$form_location.'_country_select_array', |
| 235 |
array( |
| 236 |
'' => '', |
| 237 |
'AF' => __( 'Afghanistan', 'profile-builder' ), |
| 238 |
'AX' => __( 'Aland Islands', 'profile-builder' ), |
| 239 |
'AL' => __( 'Albania', 'profile-builder' ), |
| 240 |
'DZ' => __( 'Algeria', 'profile-builder' ), |
| 241 |
'AS' => __( 'American Samoa', 'profile-builder' ), |
| 242 |
'AD' => __( 'Andorra', 'profile-builder' ), |
| 243 |
'AO' => __( 'Angola', 'profile-builder' ), |
| 244 |
'AI' => __( 'Anguilla', 'profile-builder' ), |
| 245 |
'AQ' => __( 'Antarctica', 'profile-builder' ), |
| 246 |
'AG' => __( 'Antigua and Barbuda', 'profile-builder' ), |
| 247 |
'AR' => __( 'Argentina', 'profile-builder' ), |
| 248 |
'AM' => __( 'Armenia', 'profile-builder' ), |
| 249 |
'AW' => __( 'Aruba', 'profile-builder' ), |
| 250 |
'AU' => __( 'Australia', 'profile-builder' ), |
| 251 |
'AT' => __( 'Austria', 'profile-builder' ), |
| 252 |
'AZ' => __( 'Azerbaijan', 'profile-builder' ), |
| 253 |
'BS' => __( 'Bahamas', 'profile-builder' ), |
| 254 |
'BH' => __( 'Bahrain', 'profile-builder' ), |
| 255 |
'BD' => __( 'Bangladesh', 'profile-builder' ), |
| 256 |
'BB' => __( 'Barbados', 'profile-builder' ), |
| 257 |
'BY' => __( 'Belarus', 'profile-builder' ), |
| 258 |
'BE' => __( 'Belgium', 'profile-builder' ), |
| 259 |
'BZ' => __( 'Belize', 'profile-builder' ), |
| 260 |
'BJ' => __( 'Benin', 'profile-builder' ), |
| 261 |
'BM' => __( 'Bermuda', 'profile-builder' ), |
| 262 |
'BT' => __( 'Bhutan', 'profile-builder' ), |
| 263 |
'BO' => __( 'Bolivia', 'profile-builder' ), |
| 264 |
'BQ' => __( 'Bonaire, Saint Eustatius and Saba', 'profile-builder' ), |
| 265 |
'BA' => __( 'Bosnia and Herzegovina', 'profile-builder' ), |
| 266 |
'BW' => __( 'Botswana', 'profile-builder' ), |
| 267 |
'BV' => __( 'Bouvet Island', 'profile-builder' ), |
| 268 |
'BR' => __( 'Brazil', 'profile-builder' ), |
| 269 |
'IO' => __( 'British Indian Ocean Territory', 'profile-builder' ), |
| 270 |
'VG' => __( 'British Virgin Islands', 'profile-builder' ), |
| 271 |
'BN' => __( 'Brunei', 'profile-builder' ), |
| 272 |
'BG' => __( 'Bulgaria', 'profile-builder' ), |
| 273 |
'BF' => __( 'Burkina Faso', 'profile-builder' ), |
| 274 |
'BI' => __( 'Burundi', 'profile-builder' ), |
| 275 |
'KH' => __( 'Cambodia', 'profile-builder' ), |
| 276 |
'CM' => __( 'Cameroon', 'profile-builder' ), |
| 277 |
'CA' => __( 'Canada', 'profile-builder' ), |
| 278 |
'CV' => __( 'Cape Verde', 'profile-builder' ), |
| 279 |
'KY' => __( 'Cayman Islands', 'profile-builder' ), |
| 280 |
'CF' => __( 'Central African Republic', 'profile-builder' ), |
| 281 |
'TD' => __( 'Chad', 'profile-builder' ), |
| 282 |
'CL' => __( 'Chile', 'profile-builder' ), |
| 283 |
'CN' => __( 'China', 'profile-builder' ), |
| 284 |
'CX' => __( 'Christmas Island', 'profile-builder' ), |
| 285 |
'CC' => __( 'Cocos Islands', 'profile-builder' ), |
| 286 |
'CO' => __( 'Colombia', 'profile-builder' ), |
| 287 |
'KM' => __( 'Comoros', 'profile-builder' ), |
| 288 |
'CK' => __( 'Cook Islands', 'profile-builder' ), |
| 289 |
'CR' => __( 'Costa Rica', 'profile-builder' ), |
| 290 |
'HR' => __( 'Croatia', 'profile-builder' ), |
| 291 |
'CU' => __( 'Cuba', 'profile-builder' ), |
| 292 |
'CW' => __( 'Curacao', 'profile-builder' ), |
| 293 |
'CY' => __( 'Cyprus', 'profile-builder' ), |
| 294 |
'CZ' => __( 'Czech Republic', 'profile-builder' ), |
| 295 |
'CD' => __( 'Democratic Republic of the Congo', 'profile-builder' ), |
| 296 |
'DK' => __( 'Denmark', 'profile-builder' ), |
| 297 |
'DJ' => __( 'Djibouti', 'profile-builder' ), |
| 298 |
'DM' => __( 'Dominica', 'profile-builder' ), |
| 299 |
'DO' => __( 'Dominican Republic', 'profile-builder' ), |
| 300 |
'TL' => __( 'East Timor', 'profile-builder' ), |
| 301 |
'EC' => __( 'Ecuador', 'profile-builder' ), |
| 302 |
'EG' => __( 'Egypt', 'profile-builder' ), |
| 303 |
'SV' => __( 'El Salvador', 'profile-builder' ), |
| 304 |
'GQ' => __( 'Equatorial Guinea', 'profile-builder' ), |
| 305 |
'ER' => __( 'Eritrea', 'profile-builder' ), |
| 306 |
'EE' => __( 'Estonia', 'profile-builder' ), |
| 307 |
'ET' => __( 'Ethiopia', 'profile-builder' ), |
| 308 |
'FK' => __( 'Falkland Islands', 'profile-builder' ), |
| 309 |
'FO' => __( 'Faroe Islands', 'profile-builder' ), |
| 310 |
'FJ' => __( 'Fiji', 'profile-builder' ), |
| 311 |
'FI' => __( 'Finland', 'profile-builder' ), |
| 312 |
'FR' => __( 'France', 'profile-builder' ), |
| 313 |
'GF' => __( 'French Guiana', 'profile-builder' ), |
| 314 |
'PF' => __( 'French Polynesia', 'profile-builder' ), |
| 315 |
'TF' => __( 'French Southern Territories', 'profile-builder' ), |
| 316 |
'GA' => __( 'Gabon', 'profile-builder' ), |
| 317 |
'GM' => __( 'Gambia', 'profile-builder' ), |
| 318 |
'GE' => __( 'Georgia', 'profile-builder' ), |
| 319 |
'DE' => __( 'Germany', 'profile-builder' ), |
| 320 |
'GH' => __( 'Ghana', 'profile-builder' ), |
| 321 |
'GI' => __( 'Gibraltar', 'profile-builder' ), |
| 322 |
'GR' => __( 'Greece', 'profile-builder' ), |
| 323 |
'GL' => __( 'Greenland', 'profile-builder' ), |
| 324 |
'GD' => __( 'Grenada', 'profile-builder' ), |
| 325 |
'GP' => __( 'Guadeloupe', 'profile-builder' ), |
| 326 |
'GU' => __( 'Guam', 'profile-builder' ), |
| 327 |
'GT' => __( 'Guatemala', 'profile-builder' ), |
| 328 |
'GG' => __( 'Guernsey', 'profile-builder' ), |
| 329 |
'GN' => __( 'Guinea', 'profile-builder' ), |
| 330 |
'GW' => __( 'Guinea-Bissau', 'profile-builder' ), |
| 331 |
'GY' => __( 'Guyana', 'profile-builder' ), |
| 332 |
'HT' => __( 'Haiti', 'profile-builder' ), |
| 333 |
'HM' => __( 'Heard Island and McDonald Islands', 'profile-builder' ), |
| 334 |
'HN' => __( 'Honduras', 'profile-builder' ), |
| 335 |
'HK' => __( 'Hong Kong', 'profile-builder' ), |
| 336 |
'HU' => __( 'Hungary', 'profile-builder' ), |
| 337 |
'IS' => __( 'Iceland', 'profile-builder' ), |
| 338 |
'IN' => __( 'India', 'profile-builder' ), |
| 339 |
'ID' => __( 'Indonesia', 'profile-builder' ), |
| 340 |
'IR' => __( 'Iran', 'profile-builder' ), |
| 341 |
'IQ' => __( 'Iraq', 'profile-builder' ), |
| 342 |
'IE' => __( 'Ireland', 'profile-builder' ), |
| 343 |
'IM' => __( 'Isle of Man', 'profile-builder' ), |
| 344 |
'IL' => __( 'Israel', 'profile-builder' ), |
| 345 |
'IT' => __( 'Italy', 'profile-builder' ), |
| 346 |
'CI' => __( 'Ivory Coast', 'profile-builder' ), |
| 347 |
'JM' => __( 'Jamaica', 'profile-builder' ), |
| 348 |
'JP' => __( 'Japan', 'profile-builder' ), |
| 349 |
'JE' => __( 'Jersey', 'profile-builder' ), |
| 350 |
'JO' => __( 'Jordan', 'profile-builder' ), |
| 351 |
'KZ' => __( 'Kazakhstan', 'profile-builder' ), |
| 352 |
'KE' => __( 'Kenya', 'profile-builder' ), |
| 353 |
'KI' => __( 'Kiribati', 'profile-builder' ), |
| 354 |
'XK' => __( 'Kosovo', 'profile-builder' ), |
| 355 |
'KW' => __( 'Kuwait', 'profile-builder' ), |
| 356 |
'KG' => __( 'Kyrgyzstan', 'profile-builder' ), |
| 357 |
'LA' => __( 'Laos', 'profile-builder' ), |
| 358 |
'LV' => __( 'Latvia', 'profile-builder' ), |
| 359 |
'LB' => __( 'Lebanon', 'profile-builder' ), |
| 360 |
'LS' => __( 'Lesotho', 'profile-builder' ), |
| 361 |
'LR' => __( 'Liberia', 'profile-builder' ), |
| 362 |
'LY' => __( 'Libya', 'profile-builder' ), |
| 363 |
'LI' => __( 'Liechtenstein', 'profile-builder' ), |
| 364 |
'LT' => __( 'Lithuania', 'profile-builder' ), |
| 365 |
'LU' => __( 'Luxembourg', 'profile-builder' ), |
| 366 |
'MO' => __( 'Macao', 'profile-builder' ), |
| 367 |
'MK' => __( 'Macedonia', 'profile-builder' ), |
| 368 |
'MG' => __( 'Madagascar', 'profile-builder' ), |
| 369 |
'MW' => __( 'Malawi', 'profile-builder' ), |
| 370 |
'MY' => __( 'Malaysia', 'profile-builder' ), |
| 371 |
'MV' => __( 'Maldives', 'profile-builder' ), |
| 372 |
'ML' => __( 'Mali', 'profile-builder' ), |
| 373 |
'MT' => __( 'Malta', 'profile-builder' ), |
| 374 |
'MH' => __( 'Marshall Islands', 'profile-builder' ), |
| 375 |
'MQ' => __( 'Martinique', 'profile-builder' ), |
| 376 |
'MR' => __( 'Mauritania', 'profile-builder' ), |
| 377 |
'MU' => __( 'Mauritius', 'profile-builder' ), |
| 378 |
'YT' => __( 'Mayotte', 'profile-builder' ), |
| 379 |
'MX' => __( 'Mexico', 'profile-builder' ), |
| 380 |
'FM' => __( 'Micronesia', 'profile-builder' ), |
| 381 |
'MD' => __( 'Moldova', 'profile-builder' ), |
| 382 |
'MC' => __( 'Monaco', 'profile-builder' ), |
| 383 |
'MN' => __( 'Mongolia', 'profile-builder' ), |
| 384 |
'ME' => __( 'Montenegro', 'profile-builder' ), |
| 385 |
'MS' => __( 'Montserrat', 'profile-builder' ), |
| 386 |
'MA' => __( 'Morocco', 'profile-builder' ), |
| 387 |
'MZ' => __( 'Mozambique', 'profile-builder' ), |
| 388 |
'MM' => __( 'Myanmar', 'profile-builder' ), |
| 389 |
'NA' => __( 'Namibia', 'profile-builder' ), |
| 390 |
'NR' => __( 'Nauru', 'profile-builder' ), |
| 391 |
'NP' => __( 'Nepal', 'profile-builder' ), |
| 392 |
'NL' => __( 'Netherlands', 'profile-builder' ), |
| 393 |
'NC' => __( 'New Caledonia', 'profile-builder' ), |
| 394 |
'NZ' => __( 'New Zealand', 'profile-builder' ), |
| 395 |
'NI' => __( 'Nicaragua', 'profile-builder' ), |
| 396 |
'NE' => __( 'Niger', 'profile-builder' ), |
| 397 |
'NG' => __( 'Nigeria', 'profile-builder' ), |
| 398 |
'NU' => __( 'Niue', 'profile-builder' ), |
| 399 |
'NF' => __( 'Norfolk Island', 'profile-builder' ), |
| 400 |
'KP' => __( 'North Korea', 'profile-builder' ), |
| 401 |
'MP' => __( 'Northern Mariana Islands', 'profile-builder' ), |
| 402 |
'NO' => __( 'Norway', 'profile-builder' ), |
| 403 |
'OM' => __( 'Oman', 'profile-builder' ), |
| 404 |
'PK' => __( 'Pakistan', 'profile-builder' ), |
| 405 |
'PW' => __( 'Palau', 'profile-builder' ), |
| 406 |
'PS' => __( 'Palestinian Territory', 'profile-builder' ), |
| 407 |
'PA' => __( 'Panama', 'profile-builder' ), |
| 408 |
'PG' => __( 'Papua New Guinea', 'profile-builder' ), |
| 409 |
'PY' => __( 'Paraguay', 'profile-builder' ), |
| 410 |
'PE' => __( 'Peru', 'profile-builder' ), |
| 411 |
'PH' => __( 'Philippines', 'profile-builder' ), |
| 412 |
'PN' => __( 'Pitcairn', 'profile-builder' ), |
| 413 |
'PL' => __( 'Poland', 'profile-builder' ), |
| 414 |
'PT' => __( 'Portugal', 'profile-builder' ), |
| 415 |
'PR' => __( 'Puerto Rico', 'profile-builder' ), |
| 416 |
'QA' => __( 'Qatar', 'profile-builder' ), |
| 417 |
'CG' => __( 'Republic of the Congo', 'profile-builder' ), |
| 418 |
'RE' => __( 'Reunion', 'profile-builder' ), |
| 419 |
'RO' => __( 'Romania', 'profile-builder' ), |
| 420 |
'RU' => __( 'Russia', 'profile-builder' ), |
| 421 |
'RW' => __( 'Rwanda', 'profile-builder' ), |
| 422 |
'BL' => __( 'Saint Barthelemy', 'profile-builder' ), |
| 423 |
'SH' => __( 'Saint Helena', 'profile-builder' ), |
| 424 |
'KN' => __( 'Saint Kitts and Nevis', 'profile-builder' ), |
| 425 |
'LC' => __( 'Saint Lucia', 'profile-builder' ), |
| 426 |
'MF' => __( 'Saint Martin', 'profile-builder' ), |
| 427 |
'PM' => __( 'Saint Pierre and Miquelon', 'profile-builder' ), |
| 428 |
'VC' => __( 'Saint Vincent and the Grenadines', 'profile-builder' ), |
| 429 |
'WS' => __( 'Samoa', 'profile-builder' ), |
| 430 |
'SM' => __( 'San Marino', 'profile-builder' ), |
| 431 |
'ST' => __( 'Sao Tome and Principe', 'profile-builder' ), |
| 432 |
'SA' => __( 'Saudi Arabia', 'profile-builder' ), |
| 433 |
'SN' => __( 'Senegal', 'profile-builder' ), |
| 434 |
'RS' => __( 'Serbia', 'profile-builder' ), |
| 435 |
'SC' => __( 'Seychelles', 'profile-builder' ), |
| 436 |
'SL' => __( 'Sierra Leone', 'profile-builder' ), |
| 437 |
'SG' => __( 'Singapore', 'profile-builder' ), |
| 438 |
'SX' => __( 'Sint Maarten', 'profile-builder' ), |
| 439 |
'SK' => __( 'Slovakia', 'profile-builder' ), |
| 440 |
'SI' => __( 'Slovenia', 'profile-builder' ), |
| 441 |
'SB' => __( 'Solomon Islands', 'profile-builder' ), |
| 442 |
'SO' => __( 'Somalia', 'profile-builder' ), |
| 443 |
'ZA' => __( 'South Africa', 'profile-builder' ), |
| 444 |
'GS' => __( 'South Georgia and the South Sandwich Islands', 'profile-builder' ), |
| 445 |
'KR' => __( 'South Korea', 'profile-builder' ), |
| 446 |
'SS' => __( 'South Sudan', 'profile-builder' ), |
| 447 |
'ES' => __( 'Spain', 'profile-builder' ), |
| 448 |
'LK' => __( 'Sri Lanka', 'profile-builder' ), |
| 449 |
'SD' => __( 'Sudan', 'profile-builder' ), |
| 450 |
'SR' => __( 'Suriname', 'profile-builder' ), |
| 451 |
'SJ' => __( 'Svalbard and Jan Mayen', 'profile-builder' ), |
| 452 |
'SZ' => __( 'Swaziland', 'profile-builder' ), |
| 453 |
'SE' => __( 'Sweden', 'profile-builder' ), |
| 454 |
'CH' => __( 'Switzerland', 'profile-builder' ), |
| 455 |
'SY' => __( 'Syria', 'profile-builder' ), |
| 456 |
'TW' => __( 'Taiwan', 'profile-builder' ), |
| 457 |
'TJ' => __( 'Tajikistan', 'profile-builder' ), |
| 458 |
'TZ' => __( 'Tanzania', 'profile-builder' ), |
| 459 |
'TH' => __( 'Thailand', 'profile-builder' ), |
| 460 |
'TG' => __( 'Togo', 'profile-builder' ), |
| 461 |
'TK' => __( 'Tokelau', 'profile-builder' ), |
| 462 |
'TO' => __( 'Tonga', 'profile-builder' ), |
| 463 |
'TT' => __( 'Trinidad and Tobago', 'profile-builder' ), |
| 464 |
'TN' => __( 'Tunisia', 'profile-builder' ), |
| 465 |
'TR' => __( 'Turkey', 'profile-builder' ), |
| 466 |
'TM' => __( 'Turkmenistan', 'profile-builder' ), |
| 467 |
'TC' => __( 'Turks and Caicos Islands', 'profile-builder' ), |
| 468 |
'TV' => __( 'Tuvalu', 'profile-builder' ), |
| 469 |
'VI' => __( 'U.S. Virgin Islands', 'profile-builder' ), |
| 470 |
'UG' => __( 'Uganda', 'profile-builder' ), |
| 471 |
'UA' => __( 'Ukraine', 'profile-builder' ), |
| 472 |
'AE' => __( 'United Arab Emirates', 'profile-builder' ), |
| 473 |
'GB' => __( 'United Kingdom', 'profile-builder' ), |
| 474 |
'US' => __( 'United States', 'profile-builder' ), |
| 475 |
'UM' => __( 'United States Minor Outlying Islands', 'profile-builder' ), |
| 476 |
'UY' => __( 'Uruguay', 'profile-builder' ), |
| 477 |
'UZ' => __( 'Uzbekistan', 'profile-builder' ), |
| 478 |
'VU' => __( 'Vanuatu', 'profile-builder' ), |
| 479 |
'VA' => __( 'Vatican', 'profile-builder' ), |
| 480 |
'VE' => __( 'Venezuela', 'profile-builder' ), |
| 481 |
'VN' => __( 'Vietnam', 'profile-builder' ), |
| 482 |
'WF' => __( 'Wallis and Futuna', 'profile-builder' ), |
| 483 |
'EH' => __( 'Western Sahara', 'profile-builder' ), |
| 484 |
'YE' => __( 'Yemen', 'profile-builder' ), |
| 485 |
'ZM' => __( 'Zambia', 'profile-builder' ), |
| 486 |
'ZW' => __( 'Zimbabwe', 'profile-builder' ), |
| 487 |
) |
| 488 |
); |
| 489 |
|
| 490 |
return $country_array; |
| 491 |
} |
| 492 |
|
| 493 |
|
| 494 |
/** |
| 495 |
* Function that returns an array with timezone options |
| 496 |
* |
| 497 |
* @since v.2.0 |
| 498 |
* |
| 499 |
* @return array |
| 500 |
*/ |
| 501 |
function wppb_timezone_select_options( $form_location ) { |
| 502 |
$timezone_array = apply_filters( 'wppb_'.$form_location.'_timezone_select_array', array ( '(GMT -12:00) Eniwetok, Kwajalein', '(GMT -11:00) Midway Island, Samoa', '(GMT -10:00) Hawaii', '(GMT -9:00) Alaska', '(GMT -8:00) Pacific Time (US & Canada)', '(GMT -7:00) Mountain Time (US & Canada)', '(GMT -6:00) Central Time (US & Canada), Mexico City', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '(GMT -3:30) Newfoundland', '(GMT -3:00) Brazil, Buenos Aires, Georgetown', '(GMT -2:00) Mid-Atlantic', '(GMT -1:00) Azores, Cape Verde Islands', '(GMT) Western Europe Time, London, Lisbon, Casablanca', '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris', '(GMT +2:00) Kaliningrad, South Africa', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg', '(GMT +3:30) Tehran', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '(GMT +4:30) Kabul', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent', '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi', '(GMT +5:45) Kathmandu', '(GMT +6:00) Almaty, Dhaka, Colombo', '(GMT +7:00) Bangkok, Hanoi, Jakarta', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk', '(GMT +9:30) Adelaide, Darwin', '(GMT +10:00) Eastern Australia, Guam, Vladivostok', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka' ) ); |
| 503 |
|
| 504 |
return $timezone_array; |
| 505 |
} |
| 506 |
|
| 507 |
|
| 508 |
/** |
| 509 |
* Function that returns a unique, incremented ID |
| 510 |
* |
| 511 |
* @since v.2.0 |
| 512 |
* |
| 513 |
* @return integer id |
| 514 |
*/ |
| 515 |
function wppb_get_unique_id(){ |
| 516 |
$id = 1; |
| 517 |
|
| 518 |
$wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' ); |
| 519 |
if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){ |
| 520 |
return $id; |
| 521 |
} |
| 522 |
else{ |
| 523 |
$ids_array = array(); |
| 524 |
foreach( $wppb_manage_fields as $value ){ |
| 525 |
$ids_array[] = $value['id']; |
| 526 |
} |
| 527 |
if( !empty( $ids_array ) ){ |
| 528 |
rsort( $ids_array ); |
| 529 |
$id = $ids_array[0] + 1; |
| 530 |
} |
| 531 |
} |
| 532 |
return $id; |
| 533 |
} |
| 534 |
|
| 535 |
/** |
| 536 |
* Function that checks to see if the id is unique when saving the new field |
| 537 |
* |
| 538 |
* @param array $values |
| 539 |
* |
| 540 |
* @return array |
| 541 |
*/ |
| 542 |
function wppb_check_unique_id_on_saving( $values ) { |
| 543 |
$wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' ); |
| 544 |
|
| 545 |
if( $wppb_manage_fields != 'not_found' ) { |
| 546 |
|
| 547 |
$ids_array = array(); |
| 548 |
foreach( $wppb_manage_fields as $field ){ |
| 549 |
$ids_array[] = $field['id']; |
| 550 |
} |
| 551 |
|
| 552 |
if( in_array( $values['id'], $ids_array ) ) { |
| 553 |
rsort( $ids_array ); |
| 554 |
$values['id'] = $ids_array[0] + 1; |
| 555 |
} |
| 556 |
|
| 557 |
} |
| 558 |
|
| 559 |
return $values; |
| 560 |
} |
| 561 |
add_filter( 'wck_add_meta_filter_values_wppb_manage_fields', 'wppb_check_unique_id_on_saving' ); |
| 562 |
|
| 563 |
|
| 564 |
function wppb_return_unique_field_list( $only_default_fields = false ){ |
| 565 |
|
| 566 |
$unique_field_list[] = 'Default - Name (Heading)'; |
| 567 |
$unique_field_list[] = 'Default - Contact Info (Heading)'; |
| 568 |
$unique_field_list[] = 'Default - About Yourself (Heading)'; |
| 569 |
$unique_field_list[] = 'Default - Username'; |
| 570 |
$unique_field_list[] = 'Default - First Name'; |
| 571 |
$unique_field_list[] = 'Default - Last Name'; |
| 572 |
$unique_field_list[] = 'Default - Nickname'; |
| 573 |
$unique_field_list[] = 'Default - E-mail'; |
| 574 |
$unique_field_list[] = 'Default - Website'; |
| 575 |
|
| 576 |
// Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 577 |
if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 578 |
$unique_field_list[] = 'Default - AIM'; |
| 579 |
$unique_field_list[] = 'Default - Yahoo IM'; |
| 580 |
$unique_field_list[] = 'Default - Jabber / Google Talk'; |
| 581 |
} |
| 582 |
|
| 583 |
$unique_field_list[] = 'Default - Password'; |
| 584 |
$unique_field_list[] = 'Default - Repeat Password'; |
| 585 |
$unique_field_list[] = 'Default - Biographical Info'; |
| 586 |
$unique_field_list[] = 'Default - Display name publicly as'; |
| 587 |
if( !$only_default_fields ){ |
| 588 |
$unique_field_list[] = 'Avatar'; |
| 589 |
$unique_field_list[] = 'reCAPTCHA'; |
| 590 |
$unique_field_list[] = 'Select (User Role)'; |
| 591 |
} |
| 592 |
|
| 593 |
return apply_filters ( 'wppb_unique_field_list', $unique_field_list ); |
| 594 |
} |
| 595 |
|
| 596 |
|
| 597 |
/** |
| 598 |
* Function that checks several things when adding/editing the fields |
| 599 |
* |
| 600 |
* @since v.2.0 |
| 601 |
* |
| 602 |
* @param string $message - the message to be displayed |
| 603 |
* @param array $fields - the added fields |
| 604 |
* @param array $required_fields |
| 605 |
* @param string $meta - the meta-name of the option |
| 606 |
* @param string $values - The values entered for each option |
| 607 |
* @param integer $post_id |
| 608 |
* @return boolean |
| 609 |
*/ |
| 610 |
function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $meta_name, $posted_values, $post_id ){ |
| 611 |
global $wpdb; |
| 612 |
|
| 613 |
if ( $meta_name == 'wppb_manage_fields' ){ |
| 614 |
|
| 615 |
// check for a valid field-type (fallback) |
| 616 |
if ( $posted_values['field'] == '' ) |
| 617 |
$message .= __( "You must select a field\n", 'profile-builder' ); |
| 618 |
// END check for a valid field-type (fallback) |
| 619 |
|
| 620 |
$unique_field_list = wppb_return_unique_field_list(); |
| 621 |
$all_fields = get_option ( $meta_name, 'not_set' ); |
| 622 |
|
| 623 |
// check if the unique fields are only added once |
| 624 |
if( $all_fields != 'not_set' ){ |
| 625 |
foreach( $all_fields as $field ){ |
| 626 |
if ( ( in_array ( $posted_values['field'], $unique_field_list ) ) && ( $posted_values['field'] == $field['field'] ) && ( $posted_values['id'] != $field['id'] ) ){ |
| 627 |
$message .= __( "Please choose a different field type as this one already exists in your form (must be unique)\n", 'profile-builder' ); |
| 628 |
break; |
| 629 |
} |
| 630 |
} |
| 631 |
} |
| 632 |
// END check if the unique fields are only added once |
| 633 |
|
| 634 |
// check for avatar size |
| 635 |
if ( $posted_values['field'] == 'Avatar' ){ |
| 636 |
if ( is_numeric( $posted_values['avatar-size'] ) ){ |
| 637 |
if ( ( $posted_values['avatar-size'] < 20 ) || ( $posted_values['avatar-size'] > 200 ) ) |
| 638 |
$message .= __( "The entered avatar size is not between 20 and 200\n", 'profile-builder' ); |
| 639 |
|
| 640 |
}else |
| 641 |
$message .= __( "The entered avatar size is not numerical\n", 'profile-builder' ); |
| 642 |
|
| 643 |
} |
| 644 |
// END check for avatar size |
| 645 |
|
| 646 |
// check for correct row value |
| 647 |
if ( ( $posted_values['field'] == 'Default - Biographical Info' ) || ( $posted_values['field'] == 'Textarea' ) ){ |
| 648 |
if ( !is_numeric( $posted_values['row-count'] ) ) |
| 649 |
$message .= __( "The entered row number is not numerical\n", 'profile-builder' ); |
| 650 |
|
| 651 |
elseif ( trim( $posted_values['row-count'] ) == '' ) |
| 652 |
$message .= __( "You must enter a value for the row number\n", 'profile-builder' ); |
| 653 |
} |
| 654 |
// END check for correct row value |
| 655 |
|
| 656 |
|
| 657 |
// check for the public and private keys |
| 658 |
if ( $posted_values['field'] == 'reCAPTCHA'){ |
| 659 |
if ( trim( $posted_values['public-key'] ) == '' ) |
| 660 |
$message .= __( "You must enter the site key\n", 'profile-builder' ); |
| 661 |
if ( trim( $posted_values['private-key'] ) == '' ) |
| 662 |
$message .= __( "You must enter the secret key\n", 'profile-builder' ); |
| 663 |
} |
| 664 |
// END check for the public and private keys |
| 665 |
|
| 666 |
// check for the correct the date-format |
| 667 |
if ( $posted_values['field'] == 'Datepicker' ){ |
| 668 |
$date_format = strtolower( $posted_values['date-format'] ); |
| 669 |
if ( ( trim( $date_format ) != 'mm/dd/yy' ) && ( trim( $date_format ) != 'mm/yy/dd' ) && ( trim( $date_format ) != 'dd/yy/mm' ) && ( trim( $date_format ) != 'dd/mm/yy' ) && ( trim( $date_format ) != 'yy/dd/mm' ) && ( trim( $date_format ) != 'yy/mm/dd' ) ) |
| 670 |
$message .= __( "The entered value for the Datepicker is not a valid date-format\n", 'profile-builder' ); |
| 671 |
|
| 672 |
elseif ( trim( $date_format ) == '' ) |
| 673 |
$message .= __( "You must enter a value for the date-format\n", 'profile-builder' ); |
| 674 |
} |
| 675 |
// END check for the correct the date-format |
| 676 |
|
| 677 |
//check for empty meta-name and duplicate meta-name |
| 678 |
if ( $posted_values['overwrite-existing'] == 'No' ){ |
| 679 |
$skip_check_for_fields = wppb_return_unique_field_list(true); |
| 680 |
$skip_check_for_fields = apply_filters ( 'wppb_skip_check_for_fields', $skip_check_for_fields ); |
| 681 |
|
| 682 |
if ( !in_array( trim( $posted_values['field'] ), $skip_check_for_fields ) ){ |
| 683 |
$unique_meta_name_list = array( 'first_name', 'last_name', 'nickname', 'description' ); |
| 684 |
|
| 685 |
//check to see if meta-name is empty |
| 686 |
$skip_empty_check_for_fields = array('Heading', 'Select (User Role)', 'reCAPTCHA'); |
| 687 |
|
| 688 |
if( !in_array( $posted_values['field'], $skip_empty_check_for_fields ) && empty( $posted_values['meta-name'] ) ) { |
| 689 |
$message .= __( "The meta-name cannot be empty\n", 'profile-builder' ); |
| 690 |
} |
| 691 |
|
| 692 |
// Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 693 |
if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 694 |
$unique_meta_name_list[] = 'aim'; |
| 695 |
$unique_meta_name_list[] = 'yim'; |
| 696 |
$unique_meta_name_list[] = 'jabber'; |
| 697 |
} |
| 698 |
|
| 699 |
// if the desired meta-name is one of the following, automatically give an error |
| 700 |
if ( in_array( trim( $posted_values['meta-name'] ), apply_filters ( 'wppb_unique_meta_name_list', $unique_meta_name_list ) ) ) |
| 701 |
$message .= __( "That meta-name is already in use\n", 'profile-builder' ); |
| 702 |
|
| 703 |
else{ |
| 704 |
$found_in_custom_fields = false; |
| 705 |
|
| 706 |
if( $all_fields != 'not_set' ) |
| 707 |
foreach( $all_fields as $field ){ |
| 708 |
if ( $posted_values['meta-name'] != '' && ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] != $posted_values['id'] ) ){ |
| 709 |
$message .= __( "That meta-name is already in use\n", 'profile-builder' ); |
| 710 |
$found_in_custom_fields = true; |
| 711 |
|
| 712 |
}elseif ( ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] == $posted_values['id'] ) ) |
| 713 |
$found_in_custom_fields = true; |
| 714 |
} |
| 715 |
|
| 716 |
if ( $found_in_custom_fields === false ){ |
| 717 |
$found_meta_name = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name'] ) ); |
| 718 |
if ( $found_meta_name != null ) |
| 719 |
$message .= __( "That meta-name is already in use\n", 'profile-builder' ); |
| 720 |
} |
| 721 |
} |
| 722 |
} |
| 723 |
} |
| 724 |
//END check duplicate meta-name |
| 725 |
|
| 726 |
// check for valid default option (checkbox, select, radio) |
| 727 |
if ( ( $posted_values['field'] == 'Checkbox' ) || ( $posted_values['field'] == 'Select (Multiple)' ) ) { |
| 728 |
$options = array_map( 'trim', explode( ',', $posted_values['options'] ) ); |
| 729 |
$default_options = ( ( trim( $posted_values['default-options'] ) == '' ) ? array() : array_map( 'trim', explode( ',', $posted_values['default-options'] ) ) ); |
| 730 |
|
| 731 |
/* echo "<script>console.log( Posted options: " . print_r($options, true) . "' );</script>"; |
| 732 |
echo "<script>console.log( Default options: " . print_r($default_options, true) . "' );</script>"; */ |
| 733 |
|
| 734 |
$not_found = ''; |
| 735 |
foreach ( $default_options as $key => $value ){ |
| 736 |
if ( !in_array( $value, $options ) ) |
| 737 |
$not_found .= $value . ', '; |
| 738 |
} |
| 739 |
|
| 740 |
if ( $not_found != '' ) |
| 741 |
$message .= sprintf( __( "The following option(s) did not coincide with the ones in the options list: %s\n", 'profile-builder' ), trim( $not_found, ', ' ) ); |
| 742 |
|
| 743 |
}elseif ( ( $posted_values['field'] == 'Radio' ) || ( $posted_values['field'] == 'Select' ) ){ |
| 744 |
if ( ( trim( $posted_values['default-option'] ) != '' ) && ( !in_array( $posted_values['default-option'], array_map( 'trim', explode( ',', $posted_values['options'] ) ) ) ) ) |
| 745 |
$message .= sprintf( __( "The following option did not coincide with the ones in the options list: %s\n", 'profile-builder' ), $posted_values['default-option'] ); |
| 746 |
} |
| 747 |
// END check for valid default option (checkbox, select, radio) |
| 748 |
|
| 749 |
// check to see if any user role is selected (user-role field) |
| 750 |
if( $posted_values['field'] == 'Select (User Role)' ) { |
| 751 |
if( empty( $posted_values['user-roles'] ) ) { |
| 752 |
$message .= __( "Please select at least one user role\n", 'profile-builder' ); |
| 753 |
} |
| 754 |
} |
| 755 |
// END check to see if Administrator user role has been selected (user-role field) |
| 756 |
|
| 757 |
$message = apply_filters( 'wppb_check_extra_manage_fields', $message, $posted_values ); |
| 758 |
|
| 759 |
}elseif ( ( $meta_name == 'wppb_rf_fields' ) || ( $meta_name == 'wppb_epf_fields' ) ){ |
| 760 |
if ( $posted_values['field'] == '' ){ |
| 761 |
$message .= __( "You must select a field\n", 'profile-builder' ); |
| 762 |
|
| 763 |
}else{ |
| 764 |
$fields_so_far = get_post_meta ( $post_id, $meta_name, true ); |
| 765 |
|
| 766 |
foreach ( $fields_so_far as $key => $value ){ |
| 767 |
if ( $value['field'] == $posted_values['field'] ) |
| 768 |
$message .= __( "That field is already added in this form\n", 'profile-builder' ); |
| 769 |
} |
| 770 |
} |
| 771 |
} |
| 772 |
return $message; |
| 773 |
} |
| 774 |
add_filter( 'wck_extra_message', 'wppb_check_field_on_edit_add', 10, 6 ); |
| 775 |
|
| 776 |
|
| 777 |
/** |
| 778 |
* Function that calls the wppb_hide_properties_for_already_added_fields after a field-update |
| 779 |
* |
| 780 |
* @since v.2.0 |
| 781 |
* |
| 782 |
* @param void |
| 783 |
* |
| 784 |
* @return string |
| 785 |
*/ |
| 786 |
function wppb_manage_fields_after_refresh_list( $id ){ |
| 787 |
echo "<script type=\"text/javascript\">wppb_hide_properties_for_already_added_fields( '#container_wppb_manage_fields' );</script>"; |
| 788 |
} |
| 789 |
add_action( "wck_refresh_list_wppb_manage_fields", "wppb_manage_fields_after_refresh_list" ); |
| 790 |
add_action( "wck_refresh_entry_wppb_manage_fields", "wppb_manage_fields_after_refresh_list" ); |
| 791 |
|
| 792 |
|
| 793 |
/** |
| 794 |
* Function that calls the wppb_hide_all |
| 795 |
* |
| 796 |
* @since v.2.0 |
| 797 |
* |
| 798 |
* @param void |
| 799 |
* |
| 800 |
* @return string |
| 801 |
*/ |
| 802 |
function wppb_hide_all_after_add( $id ){ |
| 803 |
echo "<script type=\"text/javascript\">wppb_hide_all( '#wppb_manage_fields' );</script>"; |
| 804 |
} |
| 805 |
add_action("wck_ajax_add_form_wppb_manage_fields", "wppb_hide_all_after_add" ); |
| 806 |
|
| 807 |
/** |
| 808 |
* Function that modifies the table header in Manage Fields to add Field Name, Field Type, Meta Key, Required |
| 809 |
* |
| 810 |
* @since v.2.0 |
| 811 |
* |
| 812 |
* @param $list, $id |
| 813 |
* |
| 814 |
* @return string |
| 815 |
*/ |
| 816 |
function wppb_manage_fields_header( $list_header ){ |
| 817 |
return '<thead><tr><th class="wck-number">#</th><th class="wck-content">'. __( '<pre>Title</pre><pre>Type</pre><pre>Meta Name</pre><pre class="wppb-mb-head-required">Required</pre>', 'profile-builder' ) .'</th><th class="wck-edit">'. __( 'Edit', 'profile-builder' ) .'</th><th class="wck-delete">'. __( 'Delete', 'profile-builder' ) .'</th></tr></thead>'; |
| 818 |
} |
| 819 |
add_action( 'wck_metabox_content_header_wppb_manage_fields', 'wppb_manage_fields_header' ); |
| 820 |
|
| 821 |
/** |
| 822 |
* Add contextual help to the side of manage fields for the shortcodes |
| 823 |
* |
| 824 |
* @since v.2.0 |
| 825 |
* |
| 826 |
* @param $hook |
| 827 |
* |
| 828 |
* @return string |
| 829 |
*/ |
| 830 |
function wppb_add_content_before_manage_fields(){ |
| 831 |
?> |
| 832 |
<p><?php _e('Use these shortcodes on the pages you want the forms to be displayed:', 'profile-builder'); ?></p> |
| 833 |
<ul> |
| 834 |
<li><strong class="nowrap">[wppb-register]</strong></li> |
| 835 |
<li><strong class="nowrap">[wppb-edit-profile]</strong></li> |
| 836 |
<li><strong class="nowrap">[wppb-register role="author"]</strong></li> |
| 837 |
</ul> |
| 838 |
<p> |
| 839 |
<?php |
| 840 |
if( PROFILE_BUILDER == 'Profile Builder Pro' ) |
| 841 |
_e("If you're interested in displaying different fields in the registration and edit profile forms, please use the Multiple Registration & Edit Profile Forms Addon.", 'profile-builder'); |
| 842 |
else |
| 843 |
_e( "With Profile Builder Pro v2 you can display different fields in the registration and edit profile forms, using the Multiple Registration & Edit Profile Forms module.", "profile-builder" ) |
| 844 |
?> |
| 845 |
</p> |
| 846 |
<?php |
| 847 |
} |
| 848 |
add_action('wck_metabox_content_wppb_manage_fields_info', 'wppb_add_content_before_manage_fields'); |
| 849 |
|
| 850 |
|
| 851 |
/** |
| 852 |
* Function that calls the wppb_edit_form_properties |
| 853 |
* |
| 854 |
* @since v.2.0 |
| 855 |
* |
| 856 |
* @param void |
| 857 |
* |
| 858 |
* @return string |
| 859 |
*/ |
| 860 |
function wppb_remove_properties_from_added_form( $meta_name, $id, $element_id ){ |
| 861 |
if ( ( $meta_name == 'wppb_epf_fields' ) || ( $meta_name == 'wppb_rf_fields' ) ) |
| 862 |
echo "<script type=\"text/javascript\">wppb_disable_delete_on_default_mandatory_fields();</script>"; |
| 863 |
|
| 864 |
if ( $meta_name == 'wppb_manage_fields' ) |
| 865 |
echo "<script type=\"text/javascript\">wppb_edit_form_properties( '#container_wppb_manage_fields', 'update_container_wppb_manage_fields_".$element_id."' );</script>"; |
| 866 |
} |
| 867 |
add_action("wck_after_adding_form", "wppb_remove_properties_from_added_form", 10, 3); |
| 868 |
|
| 869 |
/* |
| 870 |
* WPML Support for dynamic strings in Profile Builder. Tags: WPML, fields, translate |
| 871 |
*/ |
| 872 |
add_filter( 'update_option_wppb_manage_fields', 'wppb_wpml_compat_with_fields', 10, 2 ); |
| 873 |
function wppb_wpml_compat_with_fields( $oldvalue, $_newvalue ){ |
| 874 |
$default_fields = array( |
| 875 |
'Default - Name (Heading)', |
| 876 |
'Default - Contact Info (Heading)', |
| 877 |
'Default - About Yourself (Heading)', |
| 878 |
'Default - Username', |
| 879 |
'Default - First Name', |
| 880 |
'Default - Last Name', |
| 881 |
'Default - Nickname', |
| 882 |
'Default - E-mail', |
| 883 |
'Default - Website', |
| 884 |
'Default - AIM', |
| 885 |
'Default - Yahoo IM', |
| 886 |
'Default - Jabber / Google Talk', |
| 887 |
'Default - Password', |
| 888 |
'Default - Repeat Password', |
| 889 |
'Default - Biographical Info', |
| 890 |
'Default - Display name publicly as' |
| 891 |
); |
| 892 |
|
| 893 |
if ( is_array( $_newvalue ) ){ |
| 894 |
foreach ( $_newvalue as $field ){ |
| 895 |
$field_title = $field['field-title']; |
| 896 |
$field_description = $field['description']; |
| 897 |
if ( in_array($field['field'], $default_fields) ){ |
| 898 |
$prefix = 'default_field_'; |
| 899 |
} else { |
| 900 |
$prefix = 'custom_field_'; |
| 901 |
} |
| 902 |
if (function_exists('icl_register_string')){ |
| 903 |
icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_title_translation' , $field_title); |
| 904 |
icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_description_translation', $field_description); |
| 905 |
} |
| 906 |
} |
| 907 |
} |
| 908 |
} |
| 909 |
|