| @@ -8,10 +8,10 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | function wppb_manage_fields_submenu(){ |
| 10 | 10 | // create a new sub_menu page which holds the data for the default + extra fields |
| 11 | 11 | $args = array( |
| 12 | - 'menu_title' => __( 'Manage Fields', 'profilebuilder' ), | |
| 13 | - 'page_title' => __( 'Manage Default and Extra Fields', 'profilebuilder' ), | |
| 12 | + 'menu_title' => __( 'Manage Fields', 'profile-builder' ), | |
| 13 | + 'page_title' => __( 'Manage Default and Extra Fields', 'profile-builder' ), | |
| 14 | 14 | 'menu_slug' => 'manage-fields', |
| 15 | 15 | 'page_type' => 'submenu_page', |
| 16 | 16 | 'capability' => 'manage_options', |
| 17 | 17 | 'priority' => 5, |
| @@ -29,9 +29,9 @@ | ||
| 29 | 29 | $manage_field_types[] = 'Default - Last Name'; |
| 30 | 30 | $manage_field_types[] = 'Default - Nickname'; |
| 31 | 31 | $manage_field_types[] = 'Default - E-mail'; |
| 32 | 32 | $manage_field_types[] = 'Default - Website'; |
| 33 | - | |
| 33 | + | |
| 34 | 34 | // Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 35 | 35 | if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 36 | 36 | $manage_field_types[] = 'Default - AIM'; |
| 37 | 37 | $manage_field_types[] = 'Default - Yahoo IM'; |
| @@ -41,18 +41,30 @@ | ||
| 41 | 41 | $manage_field_types[] = 'Default - Password'; |
| 42 | 42 | $manage_field_types[] = 'Default - Repeat Password'; |
| 43 | 43 | $manage_field_types[] = 'Default - Biographical Info'; |
| 44 | 44 | $manage_field_types[] = 'Default - Display name publicly as'; |
| 45 | + if ( wppb_can_users_signup_blog() ) { | |
| 46 | + $manage_field_types[] = 'Default - Blog Details'; | |
| 47 | + } | |
| 45 | 48 | |
| 49 | + /* added recaptcha and user role field since version 2.6.2 */ | |
| 50 | + $manage_field_types[] = 'reCAPTCHA'; | |
| 51 | + $manage_field_types[] = 'Select (User Role)'; | |
| 52 | + | |
| 46 | 53 | if( PROFILE_BUILDER != 'Profile Builder Free' ) { |
| 47 | 54 | $manage_field_types[] = 'Heading'; |
| 48 | 55 | $manage_field_types[] = 'Input'; |
| 56 | + $manage_field_types[] = 'Number'; | |
| 49 | 57 | $manage_field_types[] = 'Input (Hidden)'; |
| 50 | 58 | $manage_field_types[] = 'Textarea'; |
| 59 | + $manage_field_types[] = 'WYSIWYG'; | |
| 60 | + $manage_field_types[] = 'Phone'; | |
| 51 | 61 | $manage_field_types[] = 'Select'; |
| 52 | 62 | $manage_field_types[] = 'Select (Multiple)'; |
| 53 | 63 | $manage_field_types[] = 'Select (Country)'; |
| 54 | 64 | $manage_field_types[] = 'Select (Timezone)'; |
| 65 | + $manage_field_types[] = 'Select (Currency)'; | |
| 66 | + $manage_field_types[] = 'Select (CPT)'; | |
| 55 | 67 | $manage_field_types[] = 'Checkbox'; |
| 56 | 68 | $manage_field_types[] = 'Checkbox (Terms and Conditions)'; |
| 57 | 69 | $manage_field_types[] = 'Radio'; |
| 58 | 70 | $manage_field_types[] = 'Upload'; |
| @@ -57,48 +69,103 @@ | ||
| 57 | 69 | $manage_field_types[] = 'Radio'; |
| 58 | 70 | $manage_field_types[] = 'Upload'; |
| 59 | 71 | $manage_field_types[] = 'Avatar'; |
| 60 | 72 | $manage_field_types[] = 'Datepicker'; |
| 61 | - $manage_field_types[] = 'reCAPTCHA'; | |
| 73 | + $manage_field_types[] = 'Timepicker'; | |
| 74 | + $manage_field_types[] = 'Colorpicker'; | |
| 75 | + $manage_field_types[] = 'Validation'; | |
| 76 | + $manage_field_types[] = 'Map'; | |
| 77 | + $manage_field_types[] = 'HTML'; | |
| 62 | 78 | } |
| 63 | 79 | |
| 64 | 80 | |
| 65 | 81 | //Free to Pro call to action on Manage Fields page |
| 66 | - $field_description = 'Choose one of the supported field types'; | |
| 82 | + $field_description = __('Choose one of the supported field types','profile-builder'); | |
| 67 | 83 | if( PROFILE_BUILDER == 'Profile Builder Free' ) { |
| 68 | - $field_description .='. Extra Field Types are available in %1$sHobbyist or PRO versions%2$s.'; | |
| 84 | + $field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) ); | |
| 69 | 85 | } |
| 70 | 86 | |
| 87 | + | |
| 88 | + //user roles | |
| 89 | + global $wp_roles; | |
| 90 | + | |
| 91 | + $user_roles = array(); | |
| 92 | + foreach( $wp_roles->roles as $user_role_slug => $user_role ) | |
| 93 | + if( $user_role_slug !== 'administrator' ) | |
| 94 | + array_push( $user_roles, '%' . $user_role['name'] . '%' . $user_role_slug ); | |
| 95 | + | |
| 96 | + | |
| 97 | + // country select | |
| 98 | + $default_country_array = wppb_country_select_options( 'back_end' ); | |
| 99 | + foreach( $default_country_array as $iso_country_code => $country_name ) { | |
| 100 | + $default_country_values[] = $iso_country_code; | |
| 101 | + $default_country_options[] = $country_name; | |
| 102 | + } | |
| 103 | + | |
| 104 | + // currency select | |
| 105 | + $default_currency_array = wppb_get_currencies( 'back_end' ); | |
| 106 | + array_unshift( $default_currency_array, '' ); | |
| 107 | + foreach( $default_currency_array as $iso_currency_code => $currency_name ) { | |
| 108 | + $default_currency_values[] = $iso_currency_code; | |
| 109 | + $default_currency_options[] = $currency_name; | |
| 110 | + } | |
| 111 | + | |
| 112 | + //cpt select | |
| 113 | + $post_types = get_post_types( array( 'public' => true ), 'names' ); | |
| 114 | + | |
| 71 | 115 | // set up the fields array |
| 72 | 116 | $fields = apply_filters( 'wppb_manage_fields', array( |
| 73 | 117 | |
| 74 | - array( 'type' => 'text', 'slug' => 'field-title', 'title' => __( 'Field Title', 'profilebuilder' ), 'description' => __( 'Title of the field', 'profilebuilder' ) ), | |
| 75 | - array( 'type' => 'select', 'slug' => 'field', 'title' => __( 'Field', 'profilebuilder' ), 'options' => apply_filters( 'wppb_manage_fields_types', $manage_field_types ), 'default-option' => true, 'description' => sprintf(__( $field_description, 'profilebuilder' ), '<a href="http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree">', '</a>') ), | |
| 76 | - array( 'type' => 'text', 'slug' => 'meta-name', 'title' => __( 'Meta-name', 'profilebuilder' ), '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', 'profilebuilder' ) ), | |
| 77 | - array( 'type' => 'text', 'slug' => 'id', 'title' => __( 'ID', 'profilebuilder' ), '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", 'profilebuilder' ), 'readonly' => true ), | |
| 78 | - array( 'type' => 'textarea', 'slug' => 'description', 'title' => __( 'Description', 'profilebuilder' ), 'description' => __( 'Enter a (detailed) description of the option for end users to read<br/>Optional', 'profilebuilder') ), | |
| 79 | - array( 'type' => 'text', 'slug' => 'row-count', 'title' => __( 'Row Count', 'profilebuilder' ), 'default' => 5, 'description' => __( "Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profilebuilder' ) ), | |
| 80 | - array( 'type' => 'text', 'slug' => 'allowed-image-extensions', 'title' => __( 'Allowed Image Extensions', 'profilebuilder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all existing image extensions (.*)', 'profilebuilder' ) ), | |
| 81 | - array( 'type' => 'text', 'slug' => 'allowed-upload-extensions', 'title' => __( 'Allowed Upload Extensions', 'profilebuilder' ), 'default' => '.*', 'description' => __( 'Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all existing extensions (.*)', 'profilebuilder' ) ), | |
| 82 | - array( 'type' => 'text', 'slug' => 'avatar-size', 'title' => __( 'Avatar Size', 'profilebuilder' ), 'default' => 100, 'description' => __( "Enter a value (between 20 and 200) for the size of the 'Avatar'<br/>If not specified, defaults to 100", 'profilebuilder' ) ), | |
| 83 | - array( 'type' => 'text', 'slug' => 'date-format', 'title' => __( 'Date-format', 'profilebuilder' ), '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', 'profilebuilder' ) ), | |
| 84 | - array( 'type' => 'textarea', 'slug' => 'terms-of-agreement', 'title' => __( 'Terms of Agreement', 'profilebuilder' ), '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>', 'profilebuilder' ) ), | |
| 85 | - array( 'type' => 'text', 'slug' => 'options', 'title' => __( 'Options', 'profilebuilder' ), '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", 'profilebuilder' ) ), | |
| 86 | - array( 'type' => 'text', 'slug' => 'labels', 'title' => __( 'Labels', 'profilebuilder' ), 'description' => __( "Enter a comma separated list of labels<br/>Visible for the user", 'profilebuilder' ) ), | |
| 87 | - array( 'type' => 'text', 'slug' => 'public-key', 'title' => __( 'Public Key', 'profilebuilder' ), 'description' => __( 'The public key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profilebuilder' ) ), | |
| 88 | - array( 'type' => 'text', 'slug' => 'private-key', 'title' => __( 'Private Key', 'profilebuilder' ), 'description' => __( 'The private key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profilebuilder' ) ), | |
| 89 | - array( 'type' => 'text', 'slug' => 'default-value', 'title' => __( 'Default Value', 'profilebuilder' ), 'description' => __( "Default value of the field", 'profilebuilder' ) ), | |
| 90 | - array( 'type' => 'text', 'slug' => 'default-option', 'title' => __( 'Default Option', 'profilebuilder' ), 'description' => __( "Specify the option which should be selected by default", 'profilebuilder' ) ), | |
| 91 | - array( 'type' => 'text', 'slug' => 'default-options', 'title' => __( 'Default Option(s)', 'profilebuilder' ), 'description' => __( "Specify the option which should be checked by default<br/>If there are multiple values, separate them with a ',' (comma)", 'profilebuilder' ) ), | |
| 92 | - array( 'type' => 'textarea', 'slug' => 'default-content', 'title' => __( 'Default Content', 'profilebuilder' ), 'description' => __( "Default value of the textarea", 'profilebuilder' ) ), | |
| 93 | - array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profilebuilder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profilebuilder' ) ), | |
| 94 | - array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profilebuilder' ), '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", 'profilebuilder' ) ), | |
| 118 | + array( 'type' => 'text', 'slug' => 'field-title', 'title' => __( 'Field Title', 'profile-builder' ), 'description' => __( 'Title of the field', 'profile-builder' ) ), | |
| 119 | + 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 ), | |
| 120 | + array( 'type' => 'text', 'slug' => 'meta-name', 'title' => __( 'Meta-name', 'profile-builder' ), 'default' => wppb_get_meta_name(), 'description' => __( 'Use this in conjunction 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 unique)<br/>Changing this might take long in case of a very big user-count', 'profile-builder' ) ), | |
| 121 | + 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 ), | |
| 122 | + 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') ), | |
| 123 | + 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' ) ), | |
| 124 | + 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' ) ), | |
| 125 | + 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' ) ), | |
| 126 | + 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' ) ), | |
| 127 | + 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, mm-dd-yy, yy-mm-dd, D, dd M yy, D, d M y, DD, dd-M-y, D, d M yy, @<br/>If not specified, defaults to mm/dd/yy', 'profile-builder' ) ), | |
| 128 | + 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' ) ), | |
| 129 | + 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' ) ), | |
| 130 | + array( 'type' => 'text', 'slug' => 'labels', 'title' => __( 'Labels', 'profile-builder' ), 'description' => __( "Enter a comma separated list of labels<br/>Visible for the user", 'profile-builder' ) ), | |
| 131 | + 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' ) ), | |
| 132 | + 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' ) ), | |
| 133 | + 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' ) ), | |
| 134 | + 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' ) ), | |
| 135 | + 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' ) ), | |
| 136 | + 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' ) ), | |
| 137 | + array( 'type' => 'text', 'slug' => 'default-value', 'title' => __( 'Default Value', 'profile-builder' ), 'description' => __( "Default value of the field", 'profile-builder' ) ), | |
| 138 | + array( 'type' => 'text', 'slug' => 'default-option', 'title' => __( 'Default Option', 'profile-builder' ), 'description' => __( "Specify the option which should be selected by default", 'profile-builder' ) ), | |
| 139 | + 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' ) ), | |
| 140 | + 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' ) ), | |
| 141 | + 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' ) ), | |
| 142 | + array( 'type' => 'select', 'slug' => 'default-option-currency', 'title' => __( 'Default Option', 'profile-builder' ), 'values' => ( isset( $default_currency_values ) ) ? $default_currency_values : '', 'options' => ( isset( $default_currency_options ) ) ? $default_currency_options : '', 'description' => __( "Default option of the field", 'profile-builder' ) ), | |
| 143 | + array( 'type' => 'select', 'slug' => 'show-currency-symbol', 'title' => __( 'Show Currency Symbol', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the currency symbol should be displayed after the currency name in the select option.', 'profile-builder' ) ), | |
| 144 | + array( 'type' => 'select', 'slug' => 'cpt', 'title' => __( 'Show Post Type', 'profile-builder' ), 'options' => $post_types, 'default' => 'post', 'description' => __( 'Posts from what post type will be displayed in the select.', 'profile-builder' ) ), | |
| 145 | + array( 'type' => 'text', 'slug' => 'validation-possible-values', 'title' => __( 'Allowable Values', 'profile-builder' ), 'description' => __( "Enter a comma separated list of possible values. Upon registration if the value provided by the user does not match one of these values, the user will not be registered.", 'profile-builder' ) ), | |
| 146 | + array( 'type' => 'text', 'slug' => 'custom-error-message', 'title' => __( 'Error Message', 'profile-builder' ), 'description' => __( "Set a custom error message that will be displayed to the user.", 'profile-builder' ) ), | |
| 147 | + array( 'type' => 'select', 'slug' => 'time-format', 'title' => __( 'Time Format', 'profile-builder' ), 'options' => array( '%12 Hours%12', '%24 Hours%24' ), 'description' => __( 'Specify the time format.', 'profile-builder' ) ), | |
| 148 | + array( 'type' => 'text', 'slug' => 'map-api-key', 'title' => __( 'Google Maps API Key', 'profile-builder' ), 'description' => __( 'Enter your Google Maps API key ( <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend" target="_blank">Get your API key</a> ). If more than one map fields are added to a form the API key from the first map displayed will be used.', 'profile-builder' ) ), | |
| 149 | + array( 'type' => 'text', 'slug' => 'map-default-lat', 'title' => __( 'Default Latitude', 'profile-builder' ), 'description' => __( "The latitude at which the map should be displayed when no pins are attached.", 'profile-builder' ) ), | |
| 150 | + array( 'type' => 'text', 'slug' => 'map-default-lng', 'title' => __( 'Default Longitude', 'profile-builder' ), 'description' => __( "The longitude at which the map should be displayed when no pins are attached.", 'profile-builder' ) ), | |
| 151 | + array( 'type' => 'text', 'slug' => 'map-default-zoom', 'title' => __( 'Default Zoom Level', 'profile-builder' ), 'description' => __( "Add a number from 0 to 19. The higher the number the higher the zoom.", 'profile-builder' ), 'default' => 16 ), | |
| 152 | + array( 'type' => 'text', 'slug' => 'map-height', 'title' => __( 'Map Height', 'profile-builder' ), 'description' => __( "The height of the map.", 'profile-builder' ), 'default' => 400 ), | |
| 153 | + array( 'type' => 'textarea', 'slug' => 'default-content', 'title' => __( 'Default Content', 'profile-builder' ), 'description' => __( "Default value of the textarea", 'profile-builder' ) ), | |
| 154 | + array( 'type' => 'textarea', 'slug' => 'html-content', 'title' => __( 'HTML Content', 'profile-builder' ), 'description' => __( "Add your HTML (or text) content", 'profile-builder' ) ), | |
| 155 | + array( 'type' => 'text', 'slug' => 'phone-format', 'title' => __( 'Phone Format', 'profile-builder' ), 'default' => '(###) ###-####', 'description' => __( "You can use: # for numbers, parentheses ( ), - sign, + sign, dot . and spaces.", 'profile-builder' ) .'<br>'. __( "Eg. (###) ###-####", 'profile-builder' ) .'<br>'. __( "Empty field won't check for correct phone number.", 'profile-builder' ) ), | |
| 156 | + array( 'type' => 'select', 'slug' => 'heading-tag', 'title' => __( 'Heading Tag', 'profile-builder' ), 'options' => array( '%h1 - biggest size%h1', 'h2', 'h3', 'h4', 'h5', '%h6 - smallest size%h6' ), 'default' => 'h4', 'description' => __( 'Change heading field size on front-end forms', 'profile-builder' ) ), | |
| 157 | + array( 'type' => 'text', 'slug' => 'min-number-value', 'title' => __( 'Min Number Value', 'profile-builder' ), 'description' => __( "Min allowed number value (0 to allow only positive numbers)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no min value", 'profile-builder' ) ), | |
| 158 | + array( 'type' => 'text', 'slug' => 'max-number-value', 'title' => __( 'Max Number Value', 'profile-builder' ), 'description' => __( "Max allowed number value (0 to allow only negative numbers)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no max value", 'profile-builder' ) ), | |
| 159 | + array( 'type' => 'text', 'slug' => 'number-step-value', 'title' => __( 'Number Step Value', 'profile-builder' ), 'description' => __( "Step value 1 to allow only integers, 0.1 to allow integers and numbers with 1 decimal", 'profile-builder' ) .'<br>'. __( "To allow multiple decimals use for eg. 0.01 (for 2 deciamls) and so on", 'profile-builder' ) .'<br>'. __( "You can also use step value to specify the legal number intervals (eg. step value 2 will allow only -4, -2, 0, 2 and so on)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no restriction", 'profile-builder' ) ), | |
| 160 | + 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' ) ), | |
| 161 | + 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' ) ), | |
| 95 | 162 | ) ); |
| 96 | 163 | |
| 97 | 164 | // create the new submenu with the above options |
| 98 | 165 | $args = array( |
| 99 | 166 | 'metabox_id' => 'manage-fields', |
| 100 | - 'metabox_title' => __( 'Field Properties', 'profilebuilder' ), | |
| 167 | + 'metabox_title' => __( 'Field Properties', 'profile-builder' ), | |
| 101 | 168 | 'post_type' => 'manage-fields', |
| 102 | 169 | 'meta_name' => 'wppb_manage_fields', |
| 103 | 170 | 'meta_array' => $fields, |
| 104 | 171 | 'context' => 'option' |
| @@ -104,14 +171,15 @@ | ||
| 104 | 171 | 'context' => 'option' |
| 105 | 172 | ); |
| 106 | 173 | new Wordpress_Creation_Kit_PB( $args ); |
| 107 | 174 | |
| 175 | + /* this is redundant but it should have a very low impact and for comfort we leave it here as well */ | |
| 108 | 176 | wppb_prepopulate_fields(); |
| 109 | 177 | |
| 110 | 178 | // create the info side meta-box |
| 111 | 179 | $args = array( |
| 112 | 180 | 'metabox_id' => 'manage-fields-info', |
| 113 | - 'metabox_title' => __( 'Registration & Edit Profile', 'profilebuilder' ), | |
| 181 | + 'metabox_title' => __( 'Registration & Edit Profile', 'profile-builder' ), | |
| 114 | 182 | 'post_type' => 'manage-fields', |
| 115 | 183 | 'meta_name' => 'wppb_manage_fields_info', |
| 116 | 184 | 'meta_array' => '', |
| 117 | 185 | 'context' => 'option', |
| @@ -118,9 +186,9 @@ | ||
| 118 | 186 | 'mb_context' => 'side' |
| 119 | 187 | ); |
| 120 | 188 | new Wordpress_Creation_Kit_PB( $args ); |
| 121 | 189 | } |
| 122 | -add_action( 'init', 'wppb_manage_fields_submenu', 10 ); | |
| 190 | +add_action( 'init', 'wppb_manage_fields_submenu', 11 ); | |
| 123 | 191 | |
| 124 | 192 | /** |
| 125 | 193 | * Function that prepopulates the manage fields list with the default fields of WP |
| 126 | 194 | * |
| @@ -128,29 +196,32 @@ | ||
| 128 | 196 | * |
| 129 | 197 | * @return void |
| 130 | 198 | */ |
| 131 | 199 | function wppb_prepopulate_fields(){ |
| 132 | - $prepopulated_fields[] = array( 'field' => 'Default - Name (Heading)', 'field-title' => __( 'Name', 'profilebuilder' ), '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' ); | |
| 133 | - $prepopulated_fields[] = array( 'field' => 'Default - Username', 'field-title' => __( 'Username', 'profilebuilder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '2', 'description' => __( 'Usernames cannot be changed.', 'profilebuilder' ), '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' ); | |
| 134 | - $prepopulated_fields[] = array( 'field' => 'Default - First Name', 'field-title' => __( 'First Name', 'profilebuilder' ), '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' ); | |
| 135 | - $prepopulated_fields[] = array( 'field' => 'Default - Last Name', 'field-title' => __( 'Last Name', 'profilebuilder' ), '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' ); | |
| 136 | - $prepopulated_fields[] = array( 'field' => 'Default - Nickname', 'field-title' => __( 'Nickname', 'profilebuilder' ), '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' ); | |
| 137 | - $prepopulated_fields[] = array( 'field' => 'Default - Display name publicly as', 'field-title' => __( 'Display name publicly as', 'profilebuilder' ), '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' ); | |
| 138 | - $prepopulated_fields[] = array( 'field' => 'Default - Contact Info (Heading)', 'field-title' => __( 'Contact Info', 'profilebuilder' ), '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' ); | |
| 139 | - $prepopulated_fields[] = array( 'field' => 'Default - E-mail', 'field-title' => __( 'E-mail', 'profilebuilder' ), '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' ); | |
| 140 | - $prepopulated_fields[] = array( 'field' => 'Default - Website', 'field-title' => __( 'Website', 'profilebuilder' ), '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' ); | |
| 200 | + $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' ); | |
| 201 | + $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' ); | |
| 202 | + $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' ); | |
| 203 | + $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' ); | |
| 204 | + $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' ); | |
| 205 | + $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' ); | |
| 206 | + $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' ); | |
| 207 | + $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' ); | |
| 208 | + $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' ); | |
| 141 | 209 | |
| 142 | 210 | // Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 143 | 211 | if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 144 | - $prepopulated_fields[] = array( 'field' => 'Default - AIM', 'field-title' => __( 'AIM', 'profilebuilder' ), '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' ); | |
| 145 | - $prepopulated_fields[] = array( 'field' => 'Default - Yahoo IM', 'field-title' => __( 'Yahoo IM', 'profilebuilder' ), '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' ); | |
| 146 | - $prepopulated_fields[] = array( 'field' => 'Default - Jabber / Google Talk', 'field-title' => __( 'Jabber / Google Talk', 'profilebuilder' ), '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' ); | |
| 212 | + $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' ); | |
| 213 | + $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' ); | |
| 214 | + $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' ); | |
| 147 | 215 | } |
| 148 | 216 | |
| 149 | - $prepopulated_fields[] = array( 'field' => 'Default - About Yourself (Heading)', 'field-title' => __( 'About Yourself', 'profilebuilder' ), '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' ); | |
| 150 | - $prepopulated_fields[] = array( 'field' => 'Default - Biographical Info', 'field-title' => __( 'Biographical Info', 'profilebuilder' ), 'meta-name' => 'description', 'overwrite-existing' => 'No', 'id' => '14', 'description' => __( 'Share a little biographical information to fill out your profile. This may be shown publicly.', 'profilebuilder' ), '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' ); | |
| 151 | - $prepopulated_fields[] = array( 'field' => 'Default - Password', 'field-title' => __( 'Password', 'profilebuilder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '15', 'description' => __( 'Type your password.', 'profilebuilder' ), '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' ); | |
| 152 | - $prepopulated_fields[] = array( 'field' => 'Default - Repeat Password', 'field-title' => __( 'Repeat Password', 'profilebuilder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '16', 'description' => __( 'Type your password again. ', 'profilebuilder' ), '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' ); | |
| 217 | + $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' ); | |
| 218 | + $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' ); | |
| 219 | + $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' ); | |
| 220 | + $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' ); | |
| 221 | + if ( wppb_can_users_signup_blog() ){ | |
| 222 | + $prepopulated_fields[] = array( 'field' => 'Default - Blog Details', 'field-title' => __( 'Blog Details', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '17', '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' ); | |
| 223 | + } | |
| 153 | 224 | |
| 154 | 225 | add_option ( 'wppb_manage_fields', apply_filters ( 'wppb_prepopulated_fields', $prepopulated_fields ) ); |
| 155 | 226 | } |
| 156 | 227 | |
| @@ -160,19 +231,20 @@ | ||
| 160 | 231 | * @since v.2.0 |
| 161 | 232 | * |
| 162 | 233 | * @return string |
| 163 | 234 | */ |
| 164 | -function wppb_get_meta_name(){ | |
| 235 | +function wppb_get_meta_name( $option = 'wppb_manage_fields', $prefix = 'custom_field_' ){ | |
| 165 | 236 | $id = 1; |
| 166 | 237 | |
| 167 | - $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' ); | |
| 238 | + $wppb_manage_fields = get_option( $option, 'not_found' ); | |
| 239 | + | |
| 168 | 240 | if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){ |
| 169 | - return 'custom_field'.$id; | |
| 241 | + return $prefix . $id; | |
| 170 | 242 | } |
| 171 | 243 | else{ |
| 172 | 244 | $meta_names = array(); |
| 173 | 245 | foreach( $wppb_manage_fields as $value ){ |
| 174 | - if ( strpos( $value['meta-name'], 'custom_field' ) === 0 ){ | |
| 246 | + if ( strpos( $value['meta-name'], $prefix ) === 0 ){ | |
| 175 | 247 | $meta_names[] = $value['meta-name']; |
| 176 | 248 | } |
| 177 | 249 | } |
| 178 | 250 | |
| @@ -178,10 +250,10 @@ | ||
| 178 | 250 | |
| 179 | 251 | if( !empty( $meta_names ) ){ |
| 180 | 252 | $meta_numbers = array(); |
| 181 | 253 | foreach( $meta_names as $meta_name ){ |
| 182 | - $number = str_replace( 'custom_field', '', $meta_name ); | |
| 183 | - /* backwards compatibility check in PB 1.3 meta_name was custom_field_# */ | |
| 254 | + $number = str_replace( $prefix, '', $meta_name ); | |
| 255 | + /* we should have an underscore present in custom_field_# so remove it */ | |
| 184 | 256 | $number = str_replace( '_', '', $number ); |
| 185 | 257 | |
| 186 | 258 | $meta_numbers[] = $number; |
| 187 | 259 | } |
| @@ -186,18 +258,615 @@ | ||
| 186 | 258 | $meta_numbers[] = $number; |
| 187 | 259 | } |
| 188 | 260 | if( !empty( $meta_numbers ) ){ |
| 189 | 261 | rsort( $meta_numbers ); |
| 190 | - $id = $meta_numbers[0]+1; | |
| 262 | + $id = $meta_numbers[0]++; | |
| 191 | 263 | } |
| 192 | 264 | } |
| 193 | - | |
| 194 | - return 'custom_field'.$id; | |
| 265 | + | |
| 266 | + return $prefix . $id; | |
| 195 | 267 | } |
| 196 | 268 | } |
| 197 | 269 | |
| 198 | 270 | |
| 199 | 271 | /** |
| 272 | + * Function that returns an array with countries | |
| 273 | + * | |
| 274 | + * @since v.2.0 | |
| 275 | + * | |
| 276 | + * @return array | |
| 277 | + */ | |
| 278 | +function wppb_country_select_options( $form_location ) { | |
| 279 | + $country_array = apply_filters( 'wppb_'.$form_location.'_country_select_array', | |
| 280 | + array( | |
| 281 | + '' => '', | |
| 282 | + 'AF' => __( 'Afghanistan', 'profile-builder' ), | |
| 283 | + 'AX' => __( 'Aland Islands', 'profile-builder' ), | |
| 284 | + 'AL' => __( 'Albania', 'profile-builder' ), | |
| 285 | + 'DZ' => __( 'Algeria', 'profile-builder' ), | |
| 286 | + 'AS' => __( 'American Samoa', 'profile-builder' ), | |
| 287 | + 'AD' => __( 'Andorra', 'profile-builder' ), | |
| 288 | + 'AO' => __( 'Angola', 'profile-builder' ), | |
| 289 | + 'AI' => __( 'Anguilla', 'profile-builder' ), | |
| 290 | + 'AQ' => __( 'Antarctica', 'profile-builder' ), | |
| 291 | + 'AG' => __( 'Antigua and Barbuda', 'profile-builder' ), | |
| 292 | + 'AR' => __( 'Argentina', 'profile-builder' ), | |
| 293 | + 'AM' => __( 'Armenia', 'profile-builder' ), | |
| 294 | + 'AW' => __( 'Aruba', 'profile-builder' ), | |
| 295 | + 'AU' => __( 'Australia', 'profile-builder' ), | |
| 296 | + 'AT' => __( 'Austria', 'profile-builder' ), | |
| 297 | + 'AZ' => __( 'Azerbaijan', 'profile-builder' ), | |
| 298 | + 'BS' => __( 'Bahamas', 'profile-builder' ), | |
| 299 | + 'BH' => __( 'Bahrain', 'profile-builder' ), | |
| 300 | + 'BD' => __( 'Bangladesh', 'profile-builder' ), | |
| 301 | + 'BB' => __( 'Barbados', 'profile-builder' ), | |
| 302 | + 'BY' => __( 'Belarus', 'profile-builder' ), | |
| 303 | + 'BE' => __( 'Belgium', 'profile-builder' ), | |
| 304 | + 'BZ' => __( 'Belize', 'profile-builder' ), | |
| 305 | + 'BJ' => __( 'Benin', 'profile-builder' ), | |
| 306 | + 'BM' => __( 'Bermuda', 'profile-builder' ), | |
| 307 | + 'BT' => __( 'Bhutan', 'profile-builder' ), | |
| 308 | + 'BO' => __( 'Bolivia', 'profile-builder' ), | |
| 309 | + 'BQ' => __( 'Bonaire, Saint Eustatius and Saba', 'profile-builder' ), | |
| 310 | + 'BA' => __( 'Bosnia and Herzegovina', 'profile-builder' ), | |
| 311 | + 'BW' => __( 'Botswana', 'profile-builder' ), | |
| 312 | + 'BV' => __( 'Bouvet Island', 'profile-builder' ), | |
| 313 | + 'BR' => __( 'Brazil', 'profile-builder' ), | |
| 314 | + 'IO' => __( 'British Indian Ocean Territory', 'profile-builder' ), | |
| 315 | + 'VG' => __( 'British Virgin Islands', 'profile-builder' ), | |
| 316 | + 'BN' => __( 'Brunei', 'profile-builder' ), | |
| 317 | + 'BG' => __( 'Bulgaria', 'profile-builder' ), | |
| 318 | + 'BF' => __( 'Burkina Faso', 'profile-builder' ), | |
| 319 | + 'BI' => __( 'Burundi', 'profile-builder' ), | |
| 320 | + 'KH' => __( 'Cambodia', 'profile-builder' ), | |
| 321 | + 'CM' => __( 'Cameroon', 'profile-builder' ), | |
| 322 | + 'CA' => __( 'Canada', 'profile-builder' ), | |
| 323 | + 'CV' => __( 'Cape Verde', 'profile-builder' ), | |
| 324 | + 'KY' => __( 'Cayman Islands', 'profile-builder' ), | |
| 325 | + 'CF' => __( 'Central African Republic', 'profile-builder' ), | |
| 326 | + 'TD' => __( 'Chad', 'profile-builder' ), | |
| 327 | + 'CL' => __( 'Chile', 'profile-builder' ), | |
| 328 | + 'CN' => __( 'China', 'profile-builder' ), | |
| 329 | + 'CX' => __( 'Christmas Island', 'profile-builder' ), | |
| 330 | + 'CC' => __( 'Cocos Islands', 'profile-builder' ), | |
| 331 | + 'CO' => __( 'Colombia', 'profile-builder' ), | |
| 332 | + 'KM' => __( 'Comoros', 'profile-builder' ), | |
| 333 | + 'CK' => __( 'Cook Islands', 'profile-builder' ), | |
| 334 | + 'CR' => __( 'Costa Rica', 'profile-builder' ), | |
| 335 | + 'HR' => __( 'Croatia', 'profile-builder' ), | |
| 336 | + 'CU' => __( 'Cuba', 'profile-builder' ), | |
| 337 | + 'CW' => __( 'Curacao', 'profile-builder' ), | |
| 338 | + 'CY' => __( 'Cyprus', 'profile-builder' ), | |
| 339 | + 'CZ' => __( 'Czech Republic', 'profile-builder' ), | |
| 340 | + 'CD' => __( 'Democratic Republic of the Congo', 'profile-builder' ), | |
| 341 | + 'DK' => __( 'Denmark', 'profile-builder' ), | |
| 342 | + 'DJ' => __( 'Djibouti', 'profile-builder' ), | |
| 343 | + 'DM' => __( 'Dominica', 'profile-builder' ), | |
| 344 | + 'DO' => __( 'Dominican Republic', 'profile-builder' ), | |
| 345 | + 'TL' => __( 'East Timor', 'profile-builder' ), | |
| 346 | + 'EC' => __( 'Ecuador', 'profile-builder' ), | |
| 347 | + 'EG' => __( 'Egypt', 'profile-builder' ), | |
| 348 | + 'SV' => __( 'El Salvador', 'profile-builder' ), | |
| 349 | + 'GQ' => __( 'Equatorial Guinea', 'profile-builder' ), | |
| 350 | + 'ER' => __( 'Eritrea', 'profile-builder' ), | |
| 351 | + 'EE' => __( 'Estonia', 'profile-builder' ), | |
| 352 | + 'ET' => __( 'Ethiopia', 'profile-builder' ), | |
| 353 | + 'FK' => __( 'Falkland Islands', 'profile-builder' ), | |
| 354 | + 'FO' => __( 'Faroe Islands', 'profile-builder' ), | |
| 355 | + 'FJ' => __( 'Fiji', 'profile-builder' ), | |
| 356 | + 'FI' => __( 'Finland', 'profile-builder' ), | |
| 357 | + 'FR' => __( 'France', 'profile-builder' ), | |
| 358 | + 'GF' => __( 'French Guiana', 'profile-builder' ), | |
| 359 | + 'PF' => __( 'French Polynesia', 'profile-builder' ), | |
| 360 | + 'TF' => __( 'French Southern Territories', 'profile-builder' ), | |
| 361 | + 'GA' => __( 'Gabon', 'profile-builder' ), | |
| 362 | + 'GM' => __( 'Gambia', 'profile-builder' ), | |
| 363 | + 'GE' => __( 'Georgia', 'profile-builder' ), | |
| 364 | + 'DE' => __( 'Germany', 'profile-builder' ), | |
| 365 | + 'GH' => __( 'Ghana', 'profile-builder' ), | |
| 366 | + 'GI' => __( 'Gibraltar', 'profile-builder' ), | |
| 367 | + 'GR' => __( 'Greece', 'profile-builder' ), | |
| 368 | + 'GL' => __( 'Greenland', 'profile-builder' ), | |
| 369 | + 'GD' => __( 'Grenada', 'profile-builder' ), | |
| 370 | + 'GP' => __( 'Guadeloupe', 'profile-builder' ), | |
| 371 | + 'GU' => __( 'Guam', 'profile-builder' ), | |
| 372 | + 'GT' => __( 'Guatemala', 'profile-builder' ), | |
| 373 | + 'GG' => __( 'Guernsey', 'profile-builder' ), | |
| 374 | + 'GN' => __( 'Guinea', 'profile-builder' ), | |
| 375 | + 'GW' => __( 'Guinea-Bissau', 'profile-builder' ), | |
| 376 | + 'GY' => __( 'Guyana', 'profile-builder' ), | |
| 377 | + 'HT' => __( 'Haiti', 'profile-builder' ), | |
| 378 | + 'HM' => __( 'Heard Island and McDonald Islands', 'profile-builder' ), | |
| 379 | + 'HN' => __( 'Honduras', 'profile-builder' ), | |
| 380 | + 'HK' => __( 'Hong Kong', 'profile-builder' ), | |
| 381 | + 'HU' => __( 'Hungary', 'profile-builder' ), | |
| 382 | + 'IS' => __( 'Iceland', 'profile-builder' ), | |
| 383 | + 'IN' => __( 'India', 'profile-builder' ), | |
| 384 | + 'ID' => __( 'Indonesia', 'profile-builder' ), | |
| 385 | + 'IR' => __( 'Iran', 'profile-builder' ), | |
| 386 | + 'IQ' => __( 'Iraq', 'profile-builder' ), | |
| 387 | + 'IE' => __( 'Ireland', 'profile-builder' ), | |
| 388 | + 'IM' => __( 'Isle of Man', 'profile-builder' ), | |
| 389 | + 'IL' => __( 'Israel', 'profile-builder' ), | |
| 390 | + 'IT' => __( 'Italy', 'profile-builder' ), | |
| 391 | + 'CI' => __( 'Ivory Coast', 'profile-builder' ), | |
| 392 | + 'JM' => __( 'Jamaica', 'profile-builder' ), | |
| 393 | + 'JP' => __( 'Japan', 'profile-builder' ), | |
| 394 | + 'JE' => __( 'Jersey', 'profile-builder' ), | |
| 395 | + 'JO' => __( 'Jordan', 'profile-builder' ), | |
| 396 | + 'KZ' => __( 'Kazakhstan', 'profile-builder' ), | |
| 397 | + 'KE' => __( 'Kenya', 'profile-builder' ), | |
| 398 | + 'KI' => __( 'Kiribati', 'profile-builder' ), | |
| 399 | + 'XK' => __( 'Kosovo', 'profile-builder' ), | |
| 400 | + 'KW' => __( 'Kuwait', 'profile-builder' ), | |
| 401 | + 'KG' => __( 'Kyrgyzstan', 'profile-builder' ), | |
| 402 | + 'LA' => __( 'Laos', 'profile-builder' ), | |
| 403 | + 'LV' => __( 'Latvia', 'profile-builder' ), | |
| 404 | + 'LB' => __( 'Lebanon', 'profile-builder' ), | |
| 405 | + 'LS' => __( 'Lesotho', 'profile-builder' ), | |
| 406 | + 'LR' => __( 'Liberia', 'profile-builder' ), | |
| 407 | + 'LY' => __( 'Libya', 'profile-builder' ), | |
| 408 | + 'LI' => __( 'Liechtenstein', 'profile-builder' ), | |
| 409 | + 'LT' => __( 'Lithuania', 'profile-builder' ), | |
| 410 | + 'LU' => __( 'Luxembourg', 'profile-builder' ), | |
| 411 | + 'MO' => __( 'Macao', 'profile-builder' ), | |
| 412 | + 'MK' => __( 'Macedonia', 'profile-builder' ), | |
| 413 | + 'MG' => __( 'Madagascar', 'profile-builder' ), | |
| 414 | + 'MW' => __( 'Malawi', 'profile-builder' ), | |
| 415 | + 'MY' => __( 'Malaysia', 'profile-builder' ), | |
| 416 | + 'MV' => __( 'Maldives', 'profile-builder' ), | |
| 417 | + 'ML' => __( 'Mali', 'profile-builder' ), | |
| 418 | + 'MT' => __( 'Malta', 'profile-builder' ), | |
| 419 | + 'MH' => __( 'Marshall Islands', 'profile-builder' ), | |
| 420 | + 'MQ' => __( 'Martinique', 'profile-builder' ), | |
| 421 | + 'MR' => __( 'Mauritania', 'profile-builder' ), | |
| 422 | + 'MU' => __( 'Mauritius', 'profile-builder' ), | |
| 423 | + 'YT' => __( 'Mayotte', 'profile-builder' ), | |
| 424 | + 'MX' => __( 'Mexico', 'profile-builder' ), | |
| 425 | + 'FM' => __( 'Micronesia', 'profile-builder' ), | |
| 426 | + 'MD' => __( 'Moldova', 'profile-builder' ), | |
| 427 | + 'MC' => __( 'Monaco', 'profile-builder' ), | |
| 428 | + 'MN' => __( 'Mongolia', 'profile-builder' ), | |
| 429 | + 'ME' => __( 'Montenegro', 'profile-builder' ), | |
| 430 | + 'MS' => __( 'Montserrat', 'profile-builder' ), | |
| 431 | + 'MA' => __( 'Morocco', 'profile-builder' ), | |
| 432 | + 'MZ' => __( 'Mozambique', 'profile-builder' ), | |
| 433 | + 'MM' => __( 'Myanmar', 'profile-builder' ), | |
| 434 | + 'NA' => __( 'Namibia', 'profile-builder' ), | |
| 435 | + 'NR' => __( 'Nauru', 'profile-builder' ), | |
| 436 | + 'NP' => __( 'Nepal', 'profile-builder' ), | |
| 437 | + 'NL' => __( 'Netherlands', 'profile-builder' ), | |
| 438 | + 'NC' => __( 'New Caledonia', 'profile-builder' ), | |
| 439 | + 'NZ' => __( 'New Zealand', 'profile-builder' ), | |
| 440 | + 'NI' => __( 'Nicaragua', 'profile-builder' ), | |
| 441 | + 'NE' => __( 'Niger', 'profile-builder' ), | |
| 442 | + 'NG' => __( 'Nigeria', 'profile-builder' ), | |
| 443 | + 'NU' => __( 'Niue', 'profile-builder' ), | |
| 444 | + 'NF' => __( 'Norfolk Island', 'profile-builder' ), | |
| 445 | + 'KP' => __( 'North Korea', 'profile-builder' ), | |
| 446 | + 'MP' => __( 'Northern Mariana Islands', 'profile-builder' ), | |
| 447 | + 'NO' => __( 'Norway', 'profile-builder' ), | |
| 448 | + 'OM' => __( 'Oman', 'profile-builder' ), | |
| 449 | + 'PK' => __( 'Pakistan', 'profile-builder' ), | |
| 450 | + 'PW' => __( 'Palau', 'profile-builder' ), | |
| 451 | + 'PS' => __( 'Palestinian Territory', 'profile-builder' ), | |
| 452 | + 'PA' => __( 'Panama', 'profile-builder' ), | |
| 453 | + 'PG' => __( 'Papua New Guinea', 'profile-builder' ), | |
| 454 | + 'PY' => __( 'Paraguay', 'profile-builder' ), | |
| 455 | + 'PE' => __( 'Peru', 'profile-builder' ), | |
| 456 | + 'PH' => __( 'Philippines', 'profile-builder' ), | |
| 457 | + 'PN' => __( 'Pitcairn', 'profile-builder' ), | |
| 458 | + 'PL' => __( 'Poland', 'profile-builder' ), | |
| 459 | + 'PT' => __( 'Portugal', 'profile-builder' ), | |
| 460 | + 'PR' => __( 'Puerto Rico', 'profile-builder' ), | |
| 461 | + 'QA' => __( 'Qatar', 'profile-builder' ), | |
| 462 | + 'CG' => __( 'Republic of the Congo', 'profile-builder' ), | |
| 463 | + 'RE' => __( 'Reunion', 'profile-builder' ), | |
| 464 | + 'RO' => __( 'Romania', 'profile-builder' ), | |
| 465 | + 'RU' => __( 'Russia', 'profile-builder' ), | |
| 466 | + 'RW' => __( 'Rwanda', 'profile-builder' ), | |
| 467 | + 'BL' => __( 'Saint Barthelemy', 'profile-builder' ), | |
| 468 | + 'SH' => __( 'Saint Helena', 'profile-builder' ), | |
| 469 | + 'KN' => __( 'Saint Kitts and Nevis', 'profile-builder' ), | |
| 470 | + 'LC' => __( 'Saint Lucia', 'profile-builder' ), | |
| 471 | + 'MF' => __( 'Saint Martin', 'profile-builder' ), | |
| 472 | + 'PM' => __( 'Saint Pierre and Miquelon', 'profile-builder' ), | |
| 473 | + 'VC' => __( 'Saint Vincent and the Grenadines', 'profile-builder' ), | |
| 474 | + 'WS' => __( 'Samoa', 'profile-builder' ), | |
| 475 | + 'SM' => __( 'San Marino', 'profile-builder' ), | |
| 476 | + 'ST' => __( 'Sao Tome and Principe', 'profile-builder' ), | |
| 477 | + 'SA' => __( 'Saudi Arabia', 'profile-builder' ), | |
| 478 | + 'SN' => __( 'Senegal', 'profile-builder' ), | |
| 479 | + 'RS' => __( 'Serbia', 'profile-builder' ), | |
| 480 | + 'SC' => __( 'Seychelles', 'profile-builder' ), | |
| 481 | + 'SL' => __( 'Sierra Leone', 'profile-builder' ), | |
| 482 | + 'SG' => __( 'Singapore', 'profile-builder' ), | |
| 483 | + 'SX' => __( 'Sint Maarten', 'profile-builder' ), | |
| 484 | + 'SK' => __( 'Slovakia', 'profile-builder' ), | |
| 485 | + 'SI' => __( 'Slovenia', 'profile-builder' ), | |
| 486 | + 'SB' => __( 'Solomon Islands', 'profile-builder' ), | |
| 487 | + 'SO' => __( 'Somalia', 'profile-builder' ), | |
| 488 | + 'ZA' => __( 'South Africa', 'profile-builder' ), | |
| 489 | + 'GS' => __( 'South Georgia and the South Sandwich Islands', 'profile-builder' ), | |
| 490 | + 'KR' => __( 'South Korea', 'profile-builder' ), | |
| 491 | + 'SS' => __( 'South Sudan', 'profile-builder' ), | |
| 492 | + 'ES' => __( 'Spain', 'profile-builder' ), | |
| 493 | + 'LK' => __( 'Sri Lanka', 'profile-builder' ), | |
| 494 | + 'SD' => __( 'Sudan', 'profile-builder' ), | |
| 495 | + 'SR' => __( 'Suriname', 'profile-builder' ), | |
| 496 | + 'SJ' => __( 'Svalbard and Jan Mayen', 'profile-builder' ), | |
| 497 | + 'SZ' => __( 'Swaziland', 'profile-builder' ), | |
| 498 | + 'SE' => __( 'Sweden', 'profile-builder' ), | |
| 499 | + 'CH' => __( 'Switzerland', 'profile-builder' ), | |
| 500 | + 'SY' => __( 'Syria', 'profile-builder' ), | |
| 501 | + 'TW' => __( 'Taiwan', 'profile-builder' ), | |
| 502 | + 'TJ' => __( 'Tajikistan', 'profile-builder' ), | |
| 503 | + 'TZ' => __( 'Tanzania', 'profile-builder' ), | |
| 504 | + 'TH' => __( 'Thailand', 'profile-builder' ), | |
| 505 | + 'TG' => __( 'Togo', 'profile-builder' ), | |
| 506 | + 'TK' => __( 'Tokelau', 'profile-builder' ), | |
| 507 | + 'TO' => __( 'Tonga', 'profile-builder' ), | |
| 508 | + 'TT' => __( 'Trinidad and Tobago', 'profile-builder' ), | |
| 509 | + 'TN' => __( 'Tunisia', 'profile-builder' ), | |
| 510 | + 'TR' => __( 'Turkey', 'profile-builder' ), | |
| 511 | + 'TM' => __( 'Turkmenistan', 'profile-builder' ), | |
| 512 | + 'TC' => __( 'Turks and Caicos Islands', 'profile-builder' ), | |
| 513 | + 'TV' => __( 'Tuvalu', 'profile-builder' ), | |
| 514 | + 'VI' => __( 'U.S. Virgin Islands', 'profile-builder' ), | |
| 515 | + 'UG' => __( 'Uganda', 'profile-builder' ), | |
| 516 | + 'UA' => __( 'Ukraine', 'profile-builder' ), | |
| 517 | + 'AE' => __( 'United Arab Emirates', 'profile-builder' ), | |
| 518 | + 'GB' => __( 'United Kingdom', 'profile-builder' ), | |
| 519 | + 'US' => __( 'United States', 'profile-builder' ), | |
| 520 | + 'UM' => __( 'United States Minor Outlying Islands', 'profile-builder' ), | |
| 521 | + 'UY' => __( 'Uruguay', 'profile-builder' ), | |
| 522 | + 'UZ' => __( 'Uzbekistan', 'profile-builder' ), | |
| 523 | + 'VU' => __( 'Vanuatu', 'profile-builder' ), | |
| 524 | + 'VA' => __( 'Vatican', 'profile-builder' ), | |
| 525 | + 'VE' => __( 'Venezuela', 'profile-builder' ), | |
| 526 | + 'VN' => __( 'Vietnam', 'profile-builder' ), | |
| 527 | + 'WF' => __( 'Wallis and Futuna', 'profile-builder' ), | |
| 528 | + 'EH' => __( 'Western Sahara', 'profile-builder' ), | |
| 529 | + 'YE' => __( 'Yemen', 'profile-builder' ), | |
| 530 | + 'ZM' => __( 'Zambia', 'profile-builder' ), | |
| 531 | + 'ZW' => __( 'Zimbabwe', 'profile-builder' ), | |
| 532 | + ) | |
| 533 | + ); | |
| 534 | + | |
| 535 | + return $country_array; | |
| 536 | +} | |
| 537 | + | |
| 538 | + | |
| 539 | +/** | |
| 540 | + * Function that returns an array with timezone options | |
| 541 | + * | |
| 542 | + * @since v.2.0 | |
| 543 | + * | |
| 544 | + * @return array | |
| 545 | + */ | |
| 546 | +function wppb_timezone_select_options( $form_location ) { | |
| 547 | + $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' ) ); | |
| 548 | + | |
| 549 | + return $timezone_array; | |
| 550 | +} | |
| 551 | + | |
| 552 | + | |
| 553 | +/* | |
| 554 | + * Array with the currency ISO code and associated currency name | |
| 555 | + * | |
| 556 | + * @param string $form_location | |
| 557 | + * | |
| 558 | + * @return array | |
| 559 | + * | |
| 560 | + */ | |
| 561 | +function wppb_get_currencies( $form_location = '' ) { | |
| 562 | + | |
| 563 | + $currencies = array( | |
| 564 | + 'ALL' => __( 'Albania Lek', 'profile-builder' ), | |
| 565 | + 'AFN' => __( 'Afghanistan Afghani', 'profile-builder' ), | |
| 566 | + 'ARS' => __( 'Argentina Peso', 'profile-builder' ), | |
| 567 | + 'AWG' => __( 'Aruba Guilder', 'wkc' ), | |
| 568 | + 'AUD' => __( 'Australia Dollar', 'profile-builder' ), | |
| 569 | + 'AZN' => __( 'Azerbaijan New Manat', 'profile-builder' ), | |
| 570 | + 'BSD' => __( 'Bahamas Dollar', 'profile-builder' ), | |
| 571 | + 'BBD' => __( 'Barbados Dollar','profile-builder' ), | |
| 572 | + 'BDT' => __( 'Bangladeshi taka','profile-builder' ), | |
| 573 | + 'BYR' => __( 'Belarus Ruble','profile-builder' ), | |
| 574 | + 'BZD' => __( 'Belize Dollar','profile-builder' ), | |
| 575 | + 'BMD' => __( 'Bermuda Dollar','profile-builder' ), | |
| 576 | + 'BOB' => __( 'Bolivia Boliviano','profile-builder' ), | |
| 577 | + 'BAM' => __( 'Bosnia and Herzegovina Convertible Marka','profile-builder' ), | |
| 578 | + 'BWP' => __( 'Botswana Pula','profile-builder' ), | |
| 579 | + 'BGN' => __( 'Bulgaria Lev','profile-builder' ), | |
| 580 | + 'BRL' => __( 'Brazil Real','profile-builder' ), | |
| 581 | + 'BND' => __( 'Brunei Darussalam Dollar','profile-builder' ), | |
| 582 | + 'KHR' => __( 'Cambodia Riel','profile-builder' ), | |
| 583 | + 'CAD' => __( 'Canada Dollar','profile-builder' ), | |
| 584 | + 'KYD' => __( 'Cayman Islands Dollar','profile-builder' ), | |
| 585 | + 'CLP' => __( 'Chile Peso','profile-builder' ), | |
| 586 | + 'CNY' => __( 'China Yuan Renminbi','profile-builder' ), | |
| 587 | + 'COP' => __( 'Colombia Peso','profile-builder' ), | |
| 588 | + 'CRC' => __( 'Costa Rica Colon','profile-builder' ), | |
| 589 | + 'HRK' => __( 'Croatia Kuna','profile-builder' ), | |
| 590 | + 'CUP' => __( 'Cuba Peso','profile-builder' ), | |
| 591 | + 'CZK' => __( 'Czech Republic Koruna','profile-builder' ), | |
| 592 | + 'DKK' => __( 'Denmark Krone','profile-builder' ), | |
| 593 | + 'DOP' => __( 'Dominican Republic Peso','profile-builder' ), | |
| 594 | + 'XCD' => __( 'East Caribbean Dollar','profile-builder' ), | |
| 595 | + 'EGP' => __( 'Egypt Pound','profile-builder' ), | |
| 596 | + 'SVC' => __( 'El Salvador Colon','profile-builder' ), | |
| 597 | + 'EEK' => __( 'Estonia Kroon','profile-builder' ), | |
| 598 | + 'EUR' => __( 'Euro','profile-builder' ), | |
| 599 | + 'FKP' => __( 'Falkland Islands (Malvinas) Pound','profile-builder' ), | |
| 600 | + 'FJD' => __( 'Fiji Dollar','profile-builder' ), | |
| 601 | + 'GHC' => __( 'Ghana Cedis','profile-builder' ), | |
| 602 | + 'GIP' => __( 'Gibraltar Pound','profile-builder' ), | |
| 603 | + 'GTQ' => __( 'Guatemala Quetzal','profile-builder' ), | |
| 604 | + 'GGP' => __( 'Guernsey Pound','profile-builder' ), | |
| 605 | + 'GYD' => __( 'Guyana Dollar','profile-builder' ), | |
| 606 | + 'HNL' => __( 'Honduras Lempira','profile-builder' ), | |
| 607 | + 'HKD' => __( 'Hong Kong Dollar','profile-builder' ), | |
| 608 | + 'HUF' => __( 'Hungary Forint','profile-builder' ), | |
| 609 | + 'ISK' => __( 'Iceland Krona','profile-builder' ), | |
| 610 | + 'INR' => __( 'India Rupee','profile-builder' ), | |
| 611 | + 'IDR' => __( 'Indonesia Rupiah','profile-builder' ), | |
| 612 | + 'IRR' => __( 'Iran Rial','profile-builder' ), | |
| 613 | + 'IMP' => __( 'Isle of Man Pound','profile-builder' ), | |
| 614 | + 'ILS' => __( 'Israel Shekel','profile-builder' ), | |
| 615 | + 'JMD' => __( 'Jamaica Dollar','profile-builder' ), | |
| 616 | + 'JPY' => __( 'Japan Yen','profile-builder' ), | |
| 617 | + 'JEP' => __( 'Jersey Pound','profile-builder' ), | |
| 618 | + 'KZT' => __( 'Kazakhstan Tenge','profile-builder' ), | |
| 619 | + 'KPW' => __( 'Korea (North) Won','profile-builder' ), | |
| 620 | + 'KRW' => __( 'Korea (South) Won','profile-builder' ), | |
| 621 | + 'KGS' => __( 'Kyrgyzstan Som','profile-builder' ), | |
| 622 | + 'LAK' => __( 'Laos Kip','profile-builder' ), | |
| 623 | + 'LVL' => __( 'Latvia Lat','profile-builder' ), | |
| 624 | + 'LBP' => __( 'Lebanon Pound','profile-builder' ), | |
| 625 | + 'LRD' => __( 'Liberia Dollar','profile-builder' ), | |
| 626 | + 'LTL' => __( 'Lithuania Litas','profile-builder' ), | |
| 627 | + 'MKD' => __( 'Macedonia Denar','profile-builder' ), | |
| 628 | + 'MYR' => __( 'Malaysia Ringgit','profile-builder' ), | |
| 629 | + 'MUR' => __( 'Mauritius Rupee','profile-builder' ), | |
| 630 | + 'MXN' => __( 'Mexico Peso','profile-builder' ), | |
| 631 | + 'MNT' => __( 'Mongolia Tughrik','profile-builder' ), | |
| 632 | + 'MZN' => __( 'Mozambique Metical','profile-builder' ), | |
| 633 | + 'NAD' => __( 'Namibia Dollar','profile-builder' ), | |
| 634 | + 'NPR' => __( 'Nepal Rupee','profile-builder' ), | |
| 635 | + 'ANG' => __( 'Netherlands Antilles Guilder','profile-builder' ), | |
| 636 | + 'NZD' => __( 'New Zealand Dollar','profile-builder' ), | |
| 637 | + 'NIO' => __( 'Nicaragua Cordoba','profile-builder' ), | |
| 638 | + 'NGN' => __( 'Nigeria Naira','profile-builder' ), | |
| 639 | + 'NOK' => __( 'Norway Krone','profile-builder' ), | |
| 640 | + 'OMR' => __( 'Oman Rial', 'profile-builder' ), | |
| 641 | + 'PKR' => __( 'Pakistan Rupee', 'profile-builder' ), | |
| 642 | + 'PAB' => __( 'Panama Balboa', 'profile-builder' ), | |
| 643 | + 'PYG' => __( 'Paraguay Guarani', 'profile-builder' ), | |
| 644 | + 'PEN' => __( 'Peru Nuevo Sol', 'profile-builder' ), | |
| 645 | + 'PHP' => __( 'Philippines Peso', 'profile-builder' ), | |
| 646 | + 'PLN' => __( 'Poland Zloty', 'profile-builder' ), | |
| 647 | + 'QAR' => __( 'Qatar Riyal', 'profile-builder' ), | |
| 648 | + 'RON' => __( 'Romania New Leu', 'profile-builder' ), | |
| 649 | + 'RUB' => __( 'Russia Ruble', 'profile-builder' ), | |
| 650 | + 'SHP' => __( 'Saint Helena Pound', 'profile-builder' ), | |
| 651 | + 'SAR' => __( 'Saudi Arabia Riyal', 'profile-builder' ), | |
| 652 | + 'RSD' => __( 'Serbia Dinar', 'profile-builder' ), | |
| 653 | + 'SCR' => __( 'Seychelles Rupee', 'profile-builder' ), | |
| 654 | + 'SGD' => __( 'Singapore Dollar', 'profile-builder' ), | |
| 655 | + 'SBD' => __( 'Solomon Islands Dollar', 'profile-builder' ), | |
| 656 | + 'SOS' => __( 'Somalia Shilling', 'profile-builder' ), | |
| 657 | + 'ZAR' => __( 'South Africa Rand', 'profile-builder' ), | |
| 658 | + 'LKR' => __( 'Sri Lanka Rupee', 'profile-builder' ), | |
| 659 | + 'SEK' => __( 'Sweden Krona', 'profile-builder' ), | |
| 660 | + 'CHF' => __( 'Switzerland Franc', 'profile-builder' ), | |
| 661 | + 'SRD' => __( 'Suriname Dollar', 'profile-builder' ), | |
| 662 | + 'SYP' => __( 'Syria Pound', 'profile-builder' ), | |
| 663 | + 'TWD' => __( 'Taiwan New Dollar', 'profile-builder' ), | |
| 664 | + 'THB' => __( 'Thailand Baht', 'profile-builder' ), | |
| 665 | + 'TTD' => __( 'Trinidad and Tobago Dollar', 'profile-builder' ), | |
| 666 | + 'TRY' => __( 'Turkey Lira', 'profile-builder' ), | |
| 667 | + 'TRL' => __( 'Turkey Lira', 'profile-builder' ), | |
| 668 | + 'TVD' => __( 'Tuvalu Dollar', 'profile-builder' ), | |
| 669 | + 'UAH' => __( 'Ukraine Hryvna', 'profile-builder' ), | |
| 670 | + 'GBP' => __( 'United Kingdom Pound', 'profile-builder' ), | |
| 671 | + 'UGX' => __( 'Uganda Shilling', 'profile-builder' ), | |
| 672 | + 'USD' => __( 'US Dollar', 'profile-builder' ), | |
| 673 | + 'UYU' => __( 'Uruguay Peso', 'profile-builder' ), | |
| 674 | + 'UZS' => __( 'Uzbekistan Som', 'profile-builder' ), | |
| 675 | + 'VEF' => __( 'Venezuela Bolivar', 'profile-builder' ), | |
| 676 | + 'VND' => __( 'Viet Nam Dong', 'profile-builder' ), | |
| 677 | + 'YER' => __( 'Yemen Rial', 'profile-builder' ), | |
| 678 | + 'ZWD' => __( 'Zimbabwe Dollar', 'profile-builder' ) | |
| 679 | + ); | |
| 680 | + | |
| 681 | + $filter_name = ( empty( $form_location ) ? 'wppb_get_currencies' : 'wppb_get_currencies_' . $form_location ); | |
| 682 | + | |
| 683 | + return apply_filters( $filter_name, $currencies ); | |
| 684 | + | |
| 685 | +} | |
| 686 | + | |
| 687 | + | |
| 688 | +/* | |
| 689 | + * Returns the currency symbol for a given currency code | |
| 690 | + * | |
| 691 | + * @param string $currency_code | |
| 692 | + * | |
| 693 | + * @return string | |
| 694 | + * | |
| 695 | + */ | |
| 696 | +function wppb_get_currency_symbol( $currency_code ) { | |
| 697 | + | |
| 698 | + $currency_symbols = array( | |
| 699 | + 'AED' => 'د.إ', // ? | |
| 700 | + 'AFN' => 'Af', | |
| 701 | + 'ALL' => 'Lek', | |
| 702 | + 'AMD' => '', | |
| 703 | + 'ANG' => 'ƒ', | |
| 704 | + 'AOA' => 'Kz', // ? | |
| 705 | + 'ARS' => '$', | |
| 706 | + 'AUD' => '$', | |
| 707 | + 'AWG' => 'ƒ', | |
| 708 | + 'AZN' => 'ман', | |
| 709 | + 'BAM' => 'KM', | |
| 710 | + 'BBD' => '$', | |
| 711 | + 'BDT' => '৳', // ? | |
| 712 | + 'BGN' => 'лв', | |
| 713 | + 'BHD' => '.د.ب', // ? | |
| 714 | + 'BIF' => 'FBu', // ? | |
| 715 | + 'BMD' => '$', | |
| 716 | + 'BND' => '$', | |
| 717 | + 'BOB' => '$b', | |
| 718 | + 'BRL' => 'R$', | |
| 719 | + 'BSD' => '$', | |
| 720 | + 'BTN' => 'Nu.', // ? | |
| 721 | + 'BWP' => 'P', | |
| 722 | + 'BYR' => 'p.', | |
| 723 | + 'BZD' => 'BZ$', | |
| 724 | + 'CAD' => '$', | |
| 725 | + 'CDF' => 'FC', | |
| 726 | + 'CHF' => 'CHF', | |
| 727 | + 'CLF' => '', // ? | |
| 728 | + 'CLP' => '$', | |
| 729 | + 'CNY' => '¥', | |
| 730 | + 'COP' => '$', | |
| 731 | + 'CRC' => '₡', | |
| 732 | + 'CUP' => '⃌', | |
| 733 | + 'CVE' => '$', // ? | |
| 734 | + 'CZK' => 'Kč', | |
| 735 | + 'DJF' => 'Fdj', // ? | |
| 736 | + 'DKK' => 'kr', | |
| 737 | + 'DOP' => 'RD$', | |
| 738 | + 'DZD' => 'دج', // ? | |
| 739 | + 'EGP' => '£', | |
| 740 | + 'ETB' => 'Br', | |
| 741 | + 'EUR' => '€', | |
| 742 | + 'FJD' => '$', | |
| 743 | + 'FKP' => '£', | |
| 744 | + 'GBP' => '£', | |
| 745 | + 'GEL' => 'ლ', // ? | |
| 746 | + 'GHS' => '¢', | |
| 747 | + 'GIP' => '£', | |
| 748 | + 'GMD' => 'D', // ? | |
| 749 | + 'GNF' => 'FG', // ? | |
| 750 | + 'GTQ' => 'Q', | |
| 751 | + 'GYD' => '$', | |
| 752 | + 'HKD' => '$', | |
| 753 | + 'HNL' => 'L', | |
| 754 | + 'HRK' => 'kn', | |
| 755 | + 'HTG' => 'G', // ? | |
| 756 | + 'HUF' => 'Ft', | |
| 757 | + 'IDR' => 'Rp', | |
| 758 | + 'ILS' => '₪', | |
| 759 | + 'INR' => '₹', | |
| 760 | + 'IQD' => 'ع.د', // ? | |
| 761 | + 'IRR' => '﷼', | |
| 762 | + 'ISK' => 'kr', | |
| 763 | + 'JEP' => '£', | |
| 764 | + 'JMD' => 'J$', | |
| 765 | + 'JOD' => 'JD', // ? | |
| 766 | + 'JPY' => '¥', | |
| 767 | + 'KES' => 'KSh', // ? | |
| 768 | + 'KGS' => 'лв', | |
| 769 | + 'KHR' => '៛', | |
| 770 | + 'KMF' => 'CF', // ? | |
| 771 | + 'KPW' => '₩', | |
| 772 | + 'KRW' => '₩', | |
| 773 | + 'KWD' => 'د.ك', // ? | |
| 774 | + 'KYD' => '$', | |
| 775 | + 'KZT' => 'лв', | |
| 776 | + 'LAK' => '₭', | |
| 777 | + 'LBP' => '£', | |
| 778 | + 'LKR' => '₨', | |
| 779 | + 'LRD' => '$', | |
| 780 | + 'LSL' => 'L', // ? | |
| 781 | + 'LTL' => 'Lt', | |
| 782 | + 'LVL' => 'Ls', | |
| 783 | + 'LYD' => 'ل.د', // ? | |
| 784 | + 'MAD' => 'د.م.', //? | |
| 785 | + 'MDL' => 'L', | |
| 786 | + 'MGA' => 'Ar', // ? | |
| 787 | + 'MKD' => 'ден', | |
| 788 | + 'MMK' => 'K', | |
| 789 | + 'MNT' => '₮', | |
| 790 | + 'MOP' => 'MOP$', // ? | |
| 791 | + 'MRO' => 'UM', // ? | |
| 792 | + 'MUR' => '₨', // ? | |
| 793 | + 'MVR' => '.ރ', // ? | |
| 794 | + 'MWK' => 'MK', | |
| 795 | + 'MXN' => '$', | |
| 796 | + 'MYR' => 'RM', | |
| 797 | + 'MZN' => 'MT', | |
| 798 | + 'NAD' => '$', | |
| 799 | + 'NGN' => '₦', | |
| 800 | + 'NIO' => 'C$', | |
| 801 | + 'NOK' => 'kr', | |
| 802 | + 'NPR' => '₨', | |
| 803 | + 'NZD' => '$', | |
| 804 | + 'OMR' => '﷼', | |
| 805 | + 'PAB' => 'B/.', | |
| 806 | + 'PEN' => 'S/.', | |
| 807 | + 'PGK' => 'K', // ? | |
| 808 | + 'PHP' => '₱', | |
| 809 | + 'PKR' => '₨', | |
| 810 | + 'PLN' => 'zł', | |
| 811 | + 'PYG' => 'Gs', | |
| 812 | + 'QAR' => '﷼', | |
| 813 | + 'RON' => 'lei', | |
| 814 | + 'RSD' => 'Дин.', | |
| 815 | + 'RUB' => 'руб', | |
| 816 | + 'RWF' => 'ر.س', | |
| 817 | + 'SAR' => '﷼', | |
| 818 | + 'SBD' => '$', | |
| 819 | + 'SCR' => '₨', | |
| 820 | + 'SDG' => '£', // ? | |
| 821 | + 'SEK' => 'kr', | |
| 822 | + 'SGD' => '$', | |
| 823 | + 'SHP' => '£', | |
| 824 | + 'SLL' => 'Le', // ? | |
| 825 | + 'SOS' => 'S', | |
| 826 | + 'SRD' => '$', | |
| 827 | + 'STD' => 'Db', // ? | |
| 828 | + 'SVC' => '$', | |
| 829 | + 'SYP' => '£', | |
| 830 | + 'SZL' => 'L', // ? | |
| 831 | + 'THB' => '฿', | |
| 832 | + 'TJS' => 'TJS', // ? TJS (guess) | |
| 833 | + 'TMT' => 'm', | |
| 834 | + 'TND' => 'د.ت', | |
| 835 | + 'TOP' => 'T$', | |
| 836 | + 'TRY' => '₤', // New Turkey Lira (old symbol used) | |
| 837 | + 'TTD' => '$', | |
| 838 | + 'TWD' => 'NT$', | |
| 839 | + 'TZS' => '', | |
| 840 | + 'UAH' => '₴', | |
| 841 | + 'UGX' => 'USh', | |
| 842 | + 'USD' => '$', | |
| 843 | + 'UYU' => '$U', | |
| 844 | + 'UZS' => 'лв', | |
| 845 | + 'VEF' => 'Bs', | |
| 846 | + 'VND' => '₫', | |
| 847 | + 'VUV' => 'VT', | |
| 848 | + 'WST' => 'WS$', | |
| 849 | + 'XAF' => 'FCFA', | |
| 850 | + 'XCD' => '$', | |
| 851 | + 'XDR' => '', | |
| 852 | + 'XOF' => '', | |
| 853 | + 'XPF' => 'F', | |
| 854 | + 'YER' => '﷼', | |
| 855 | + 'ZAR' => 'R', | |
| 856 | + 'ZMK' => 'ZK', // ? | |
| 857 | + 'ZWL' => 'Z$', | |
| 858 | + ); | |
| 859 | + | |
| 860 | + if( !empty( $currency_symbols[$currency_code] ) ) | |
| 861 | + return $currency_symbols[$currency_code]; | |
| 862 | + else | |
| 863 | + return ''; | |
| 864 | + | |
| 865 | +} | |
| 866 | + | |
| 867 | + | |
| 868 | +/** | |
| 200 | 869 | * Function that returns a unique, incremented ID |
| 201 | 870 | * |
| 202 | 871 | * @since v.2.0 |
| 203 | 872 | * |
| @@ -204,10 +873,9 @@ | ||
| 204 | 873 | * @return integer id |
| 205 | 874 | */ |
| 206 | 875 | function wppb_get_unique_id(){ |
| 207 | 876 | $id = 1; |
| 208 | - | |
| 209 | - $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' ); | |
| 877 | + $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' ); | |
| 210 | 878 | if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){ |
| 211 | 879 | return $id; |
| 212 | 880 | } |
| 213 | 881 | else{ |
| @@ -216,14 +884,42 @@ | ||
| 216 | 884 | $ids_array[] = $value['id']; |
| 217 | 885 | } |
| 218 | 886 | if( !empty( $ids_array ) ){ |
| 219 | 887 | rsort( $ids_array ); |
| 220 | - $id = $ids_array[0]+1; | |
| 888 | + $id = $ids_array[0] + 1; | |
| 221 | 889 | } |
| 222 | 890 | } |
| 223 | - return $id; | |
| 891 | + return apply_filters( 'wppb_field_unique_id', $id, $ids_array, $wppb_manage_fields ); | |
| 224 | 892 | } |
| 225 | 893 | |
| 894 | +/** | |
| 895 | + * Function that checks to see if the id is unique when saving the new field | |
| 896 | + * | |
| 897 | + * @param array $values | |
| 898 | + * | |
| 899 | + * @return array | |
| 900 | + */ | |
| 901 | +function wppb_check_unique_id_on_saving( $values ) { | |
| 902 | + $wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' ); | |
| 903 | + | |
| 904 | + if( $wppb_manage_fields != 'not_found' ) { | |
| 905 | + | |
| 906 | + $ids_array = array(); | |
| 907 | + foreach( $wppb_manage_fields as $field ){ | |
| 908 | + $ids_array[] = $field['id']; | |
| 909 | + } | |
| 910 | + | |
| 911 | + if( in_array( $values['id'], $ids_array ) ) { | |
| 912 | + rsort( $ids_array ); | |
| 913 | + $values['id'] = $ids_array[0] + 1; | |
| 914 | + } | |
| 915 | + | |
| 916 | + } | |
| 917 | + return $values; | |
| 918 | +} | |
| 919 | +add_filter( 'wck_add_meta_filter_values_wppb_manage_fields', 'wppb_check_unique_id_on_saving' ); | |
| 920 | + | |
| 921 | + | |
| 226 | 922 | function wppb_return_unique_field_list( $only_default_fields = false ){ |
| 227 | 923 | |
| 228 | 924 | $unique_field_list[] = 'Default - Name (Heading)'; |
| 229 | 925 | $unique_field_list[] = 'Default - Contact Info (Heading)'; |
| @@ -233,9 +929,9 @@ | ||
| 233 | 929 | $unique_field_list[] = 'Default - Last Name'; |
| 234 | 930 | $unique_field_list[] = 'Default - Nickname'; |
| 235 | 931 | $unique_field_list[] = 'Default - E-mail'; |
| 236 | 932 | $unique_field_list[] = 'Default - Website'; |
| 237 | - | |
| 933 | + | |
| 238 | 934 | // Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 239 | 935 | if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 240 | 936 | $unique_field_list[] = 'Default - AIM'; |
| 241 | 937 | $unique_field_list[] = 'Default - Yahoo IM'; |
| @@ -245,11 +941,17 @@ | ||
| 245 | 941 | $unique_field_list[] = 'Default - Password'; |
| 246 | 942 | $unique_field_list[] = 'Default - Repeat Password'; |
| 247 | 943 | $unique_field_list[] = 'Default - Biographical Info'; |
| 248 | 944 | $unique_field_list[] = 'Default - Display name publicly as'; |
| 945 | + | |
| 946 | + if ( wppb_can_users_signup_blog() ) { | |
| 947 | + $unique_field_list[] = 'Default - Blog Details'; | |
| 948 | + } | |
| 949 | + | |
| 249 | 950 | if( !$only_default_fields ){ |
| 250 | 951 | $unique_field_list[] = 'Avatar'; |
| 251 | 952 | $unique_field_list[] = 'reCAPTCHA'; |
| 953 | + $unique_field_list[] = 'Select (User Role)'; | |
| 252 | 954 | } |
| 253 | 955 | |
| 254 | 956 | return apply_filters ( 'wppb_unique_field_list', $unique_field_list ); |
| 255 | 957 | } |
| @@ -255,9 +957,9 @@ | ||
| 255 | 957 | } |
| 256 | 958 | |
| 257 | 959 | |
| 258 | 960 | /** |
| 259 | - * Function that checks several things when adding/editin the fields | |
| 961 | + * Function that checks several things when adding/editing the fields | |
| 260 | 962 | * |
| 261 | 963 | * @since v.2.0 |
| 262 | 964 | * |
| 263 | 965 | * @param string $message - the message to be displayed |
| @@ -269,38 +971,38 @@ | ||
| 269 | 971 | * @return boolean |
| 270 | 972 | */ |
| 271 | 973 | function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $meta_name, $posted_values, $post_id ){ |
| 272 | 974 | global $wpdb; |
| 273 | - | |
| 975 | + | |
| 274 | 976 | if ( $meta_name == 'wppb_manage_fields' ){ |
| 275 | 977 | |
| 276 | 978 | // check for a valid field-type (fallback) |
| 277 | 979 | if ( $posted_values['field'] == '' ) |
| 278 | - $message .= __( "You must select a field\n", 'profilebuilder' ); | |
| 980 | + $message .= __( "You must select a field\n", 'profile-builder' ); | |
| 279 | 981 | // END check for a valid field-type (fallback) |
| 280 | 982 | |
| 281 | 983 | $unique_field_list = wppb_return_unique_field_list(); |
| 282 | - $all_fields = get_option ( $meta_name, 'not_set' ); | |
| 984 | + $all_fields = apply_filters( 'wppb_manage_fields_check_field_on_edit_add', get_option ( $meta_name, 'not_set' ), $posted_values ); | |
| 283 | 985 | |
| 284 | 986 | // check if the unique fields are only added once |
| 285 | 987 | if( $all_fields != 'not_set' ){ |
| 286 | 988 | foreach( $all_fields as $field ){ |
| 287 | 989 | if ( ( in_array ( $posted_values['field'], $unique_field_list ) ) && ( $posted_values['field'] == $field['field'] ) && ( $posted_values['id'] != $field['id'] ) ){ |
| 288 | - $message .= __( "Please choose a different field type as this one already exists in your form (must be unique)\n", 'profilebuilder' ); | |
| 990 | + $message .= __( "Please choose a different field type as this one already exists in your form (must be unique)\n", 'profile-builder' ); | |
| 289 | 991 | break; |
| 290 | 992 | } |
| 291 | 993 | } |
| 292 | 994 | } |
| 293 | 995 | // END check if the unique fields are only added once |
| 294 | - | |
| 996 | + | |
| 295 | 997 | // check for avatar size |
| 296 | 998 | if ( $posted_values['field'] == 'Avatar' ){ |
| 297 | 999 | if ( is_numeric( $posted_values['avatar-size'] ) ){ |
| 298 | 1000 | if ( ( $posted_values['avatar-size'] < 20 ) || ( $posted_values['avatar-size'] > 200 ) ) |
| 299 | - $message .= __( "The entered avatar size is not between 20 and 200\n", 'profilebuilder' ); | |
| 1001 | + $message .= __( "The entered avatar size is not between 20 and 200\n", 'profile-builder' ); | |
| 300 | 1002 | |
| 301 | 1003 | }else |
| 302 | - $message .= __( "The entered avatar size is not numerical\n", 'profilebuilder' ); | |
| 1004 | + $message .= __( "The entered avatar size is not numerical\n", 'profile-builder' ); | |
| 303 | 1005 | |
| 304 | 1006 | } |
| 305 | 1007 | // END check for avatar size |
| 306 | 1008 | |
| @@ -306,12 +1008,12 @@ | ||
| 306 | 1008 | |
| 307 | 1009 | // check for correct row value |
| 308 | 1010 | if ( ( $posted_values['field'] == 'Default - Biographical Info' ) || ( $posted_values['field'] == 'Textarea' ) ){ |
| 309 | 1011 | if ( !is_numeric( $posted_values['row-count'] ) ) |
| 310 | - $message .= __( "The entered row number is not numerical\n", 'profilebuilder' ); | |
| 1012 | + $message .= __( "The entered row number is not numerical\n", 'profile-builder' ); | |
| 311 | 1013 | |
| 312 | 1014 | elseif ( trim( $posted_values['row-count'] ) == '' ) |
| 313 | - $message .= __( "You must enter a value for the row number\n", 'profilebuilder' ); | |
| 1015 | + $message .= __( "You must enter a value for the row number\n", 'profile-builder' ); | |
| 314 | 1016 | } |
| 315 | 1017 | // END check for correct row value |
| 316 | 1018 | |
| 317 | 1019 | |
| @@ -317,11 +1019,11 @@ | ||
| 317 | 1019 | |
| 318 | 1020 | // check for the public and private keys |
| 319 | 1021 | if ( $posted_values['field'] == 'reCAPTCHA'){ |
| 320 | 1022 | if ( trim( $posted_values['public-key'] ) == '' ) |
| 321 | - $message .= __( "You must enter the public key\n", 'profilebuilder' ); | |
| 1023 | + $message .= __( "You must enter the site key\n", 'profile-builder' ); | |
| 322 | 1024 | if ( trim( $posted_values['private-key'] ) == '' ) |
| 323 | - $message .= __( "You must enter the private key\n", 'profilebuilder' ); | |
| 1025 | + $message .= __( "You must enter the secret key\n", 'profile-builder' ); | |
| 324 | 1026 | } |
| 325 | 1027 | // END check for the public and private keys |
| 326 | 1028 | |
| 327 | 1029 | // check for the correct the date-format |
| @@ -326,17 +1028,20 @@ | ||
| 326 | 1028 | |
| 327 | 1029 | // check for the correct the date-format |
| 328 | 1030 | if ( $posted_values['field'] == 'Datepicker' ){ |
| 329 | 1031 | $date_format = strtolower( $posted_values['date-format'] ); |
| 330 | - 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' ) ) | |
| 331 | - $message .= __( "The entered value for the Datepicker is not a valid date-format\n", 'profilebuilder' ); | |
| 1032 | + if ( trim( $date_format ) != 'mm/dd/yy' && trim( $date_format ) != 'mm/yy/dd' && trim( $date_format ) != 'dd/yy/mm' && | |
| 1033 | + trim( $date_format ) != 'dd/mm/yy' && trim( $date_format ) != 'yy/dd/mm' && trim( $date_format ) != 'yy/mm/dd' && | |
| 1034 | + trim( $date_format ) != 'yy-mm-dd' && trim( $date_format ) != 'DD, dd-M-y' && trim( $date_format ) != 'D, dd M yy' && | |
| 1035 | + trim( $date_format ) != 'D, d M y' && trim( $date_format ) != 'D, d M yy' && trim( $date_format ) != 'mm-dd-yy' && trim( $date_format ) != '@' ) | |
| 1036 | + $message .= __( "The entered value for the Datepicker is not a valid date-format\n", 'profile-builder' ); | |
| 332 | 1037 | |
| 333 | 1038 | elseif ( trim( $date_format ) == '' ) |
| 334 | - $message .= __( "You must enter a value for the date-format\n", 'profilebuilder' ); | |
| 1039 | + $message .= __( "You must enter a value for the date-format\n", 'profile-builder' ); | |
| 335 | 1040 | } |
| 336 | 1041 | // END check for the correct the date-format |
| 337 | 1042 | |
| 338 | - //check duplicate meta-name | |
| 1043 | + //check for empty meta-name and duplicate meta-name | |
| 339 | 1044 | if ( $posted_values['overwrite-existing'] == 'No' ){ |
| 340 | 1045 | $skip_check_for_fields = wppb_return_unique_field_list(true); |
| 341 | 1046 | $skip_check_for_fields = apply_filters ( 'wppb_skip_check_for_fields', $skip_check_for_fields ); |
| 342 | 1047 | |
| @@ -341,9 +1046,16 @@ | ||
| 341 | 1046 | $skip_check_for_fields = apply_filters ( 'wppb_skip_check_for_fields', $skip_check_for_fields ); |
| 342 | 1047 | |
| 343 | 1048 | if ( !in_array( trim( $posted_values['field'] ), $skip_check_for_fields ) ){ |
| 344 | 1049 | $unique_meta_name_list = array( 'first_name', 'last_name', 'nickname', 'description' ); |
| 345 | - | |
| 1050 | + | |
| 1051 | + //check to see if meta-name is empty | |
| 1052 | + $skip_empty_check_for_fields = array( 'Heading', 'Select (User Role)', 'reCAPTCHA', 'HTML' ); | |
| 1053 | + | |
| 1054 | + if( !in_array( $posted_values['field'], $skip_empty_check_for_fields ) && empty( $posted_values['meta-name'] ) ) { | |
| 1055 | + $message .= __( "The meta-name cannot be empty\n", 'profile-builder' ); | |
| 1056 | + } | |
| 1057 | + | |
| 346 | 1058 | // Default contact methods were removed in WP 3.6. A filter dictates contact methods. |
| 347 | 1059 | if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ |
| 348 | 1060 | $unique_meta_name_list[] = 'aim'; |
| 349 | 1061 | $unique_meta_name_list[] = 'yim'; |
| @@ -351,9 +1063,9 @@ | ||
| 351 | 1063 | } |
| 352 | 1064 | |
| 353 | 1065 | // if the desired meta-name is one of the following, automatically give an error |
| 354 | 1066 | if ( in_array( trim( $posted_values['meta-name'] ), apply_filters ( 'wppb_unique_meta_name_list', $unique_meta_name_list ) ) ) |
| 355 | - $message .= __( "That meta-name is already in use\n", 'profilebuilder' ); | |
| 1067 | + $message .= __( "That meta-name is already in use\n", 'profile-builder' ); | |
| 356 | 1068 | |
| 357 | 1069 | else{ |
| 358 | 1070 | $found_in_custom_fields = false; |
| 359 | 1071 | |
| @@ -359,9 +1071,9 @@ | ||
| 359 | 1071 | |
| 360 | 1072 | if( $all_fields != 'not_set' ) |
| 361 | 1073 | foreach( $all_fields as $field ){ |
| 362 | 1074 | if ( $posted_values['meta-name'] != '' && ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] != $posted_values['id'] ) ){ |
| 363 | - $message .= __( "That meta-name is already in use\n", 'profilebuilder' ); | |
| 1075 | + $message .= __( "That meta-name is already in use\n", 'profile-builder' ); | |
| 364 | 1076 | $found_in_custom_fields = true; |
| 365 | 1077 | |
| 366 | 1078 | }elseif ( ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] == $posted_values['id'] ) ) |
| 367 | 1079 | $found_in_custom_fields = true; |
| @@ -367,16 +1079,26 @@ | ||
| 367 | 1079 | $found_in_custom_fields = true; |
| 368 | 1080 | } |
| 369 | 1081 | |
| 370 | 1082 | if ( $found_in_custom_fields === false ){ |
| 371 | - $found_meta_name = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name'] ) ); | |
| 372 | - if ( $found_meta_name != null ) | |
| 373 | - $message .= __( "That meta-name is already in use\n", 'profilebuilder' ); | |
| 1083 | + if( $posted_values['meta-name'] != '' ) { | |
| 1084 | + $found_meta_name = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name'])); | |
| 1085 | + if ($found_meta_name != null) | |
| 1086 | + $message .= __("That meta-name is already in use\n", 'profile-builder'); | |
| 1087 | + } | |
| 374 | 1088 | } |
| 375 | 1089 | } |
| 376 | 1090 | } |
| 377 | 1091 | } |
| 378 | 1092 | //END check duplicate meta-name |
| 1093 | + | |
| 1094 | + // check for correct meta name on upload field | |
| 1095 | + if( $posted_values['field'] == 'Upload' ) { | |
| 1096 | + if( ! empty( $posted_values['meta-name'] ) && preg_match( '/([^a-z\d_-])/', $posted_values['meta-name'] ) ) { | |
| 1097 | + $message .= __( "The meta-name can only contain lowercase letters, numbers, _ , - and no spaces.\n", 'profile-builder' ); | |
| 1098 | + } | |
| 1099 | + } | |
| 1100 | + // END check for correct meta name on upload field | |
| 379 | 1101 | |
| 380 | 1102 | // check for valid default option (checkbox, select, radio) |
| 381 | 1103 | if ( ( $posted_values['field'] == 'Checkbox' ) || ( $posted_values['field'] == 'Select (Multiple)' ) ) { |
| 382 | 1104 | $options = array_map( 'trim', explode( ',', $posted_values['options'] ) ); |
| @@ -391,26 +1113,36 @@ | ||
| 391 | 1113 | $not_found .= $value . ', '; |
| 392 | 1114 | } |
| 393 | 1115 | |
| 394 | 1116 | if ( $not_found != '' ) |
| 395 | - $message .= sprintf( __( "The following option(s) did not coincide with the ones in the options list: %s\n", 'profilebuilder' ), trim( $not_found, ', ' ) ); | |
| 1117 | + $message .= sprintf( __( "The following option(s) did not coincide with the ones in the options list: %s\n", 'profile-builder' ), trim( $not_found, ', ' ) ); | |
| 396 | 1118 | |
| 397 | 1119 | }elseif ( ( $posted_values['field'] == 'Radio' ) || ( $posted_values['field'] == 'Select' ) ){ |
| 398 | 1120 | if ( ( trim( $posted_values['default-option'] ) != '' ) && ( !in_array( $posted_values['default-option'], array_map( 'trim', explode( ',', $posted_values['options'] ) ) ) ) ) |
| 399 | - $message .= sprintf( __( "The following option did not coincide with the ones in the options list: %s\n", 'profilebuilder' ), $posted_values['default-option'] ); | |
| 1121 | + $message .= sprintf( __( "The following option did not coincide with the ones in the options list: %s\n", 'profile-builder' ), $posted_values['default-option'] ); | |
| 400 | 1122 | } |
| 401 | 1123 | // END check for valid default option (checkbox, select, radio) |
| 402 | - | |
| 1124 | + | |
| 1125 | + // check to see if any user role is selected (user-role field) | |
| 1126 | + if( $posted_values['field'] == 'Select (User Role)' ) { | |
| 1127 | + if( empty( $posted_values['user-roles'] ) ) { | |
| 1128 | + $message .= __( "Please select at least one user role\n", 'profile-builder' ); | |
| 1129 | + } | |
| 1130 | + } | |
| 1131 | + // END check to see if Administrator user role has been selected (user-role field) | |
| 1132 | + | |
| 1133 | + $message = apply_filters( 'wppb_check_extra_manage_fields', $message, $posted_values ); | |
| 1134 | + | |
| 403 | 1135 | }elseif ( ( $meta_name == 'wppb_rf_fields' ) || ( $meta_name == 'wppb_epf_fields' ) ){ |
| 404 | 1136 | if ( $posted_values['field'] == '' ){ |
| 405 | - $message .= __( "You must select a field\n", 'profilebuilder' ); | |
| 1137 | + $message .= __( "You must select a field\n", 'profile-builder' ); | |
| 406 | 1138 | |
| 407 | 1139 | }else{ |
| 408 | 1140 | $fields_so_far = get_post_meta ( $post_id, $meta_name, true ); |
| 409 | 1141 | |
| 410 | 1142 | foreach ( $fields_so_far as $key => $value ){ |
| 411 | - if ( $value['field'] == $posted_values['field'] ) | |
| 412 | - $message .= __( "That field is already added in this form\n", 'profilebuilder' ); | |
| 1143 | + if ( $value['id'] == $posted_values['id'] ) | |
| 1144 | + $message .= __( "That field is already added in this form\n", 'profile-builder' ); | |
| 413 | 1145 | } |
| 414 | 1146 | } |
| 415 | 1147 | } |
| 416 | 1148 | return $message; |
| @@ -457,9 +1189,9 @@ | ||
| 457 | 1189 | * |
| 458 | 1190 | * @return string |
| 459 | 1191 | */ |
| 460 | 1192 | function wppb_manage_fields_header( $list_header ){ |
| 461 | - 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>', 'profilebuilder' ) .'</th><th class="wck-edit">'. __( 'Edit', 'profilebuilder' ) .'</th><th class="wck-delete">'. __( 'Delete', 'profilebuilder' ) .'</th></tr></thead>'; | |
| 1193 | + 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>'; | |
| 462 | 1194 | } |
| 463 | 1195 | add_action( 'wck_metabox_content_header_wppb_manage_fields', 'wppb_manage_fields_header' ); |
| 464 | 1196 | |
| 465 | 1197 | /** |
| @@ -472,15 +1204,22 @@ | ||
| 472 | 1204 | * @return string |
| 473 | 1205 | */ |
| 474 | 1206 | function wppb_add_content_before_manage_fields(){ |
| 475 | 1207 | ?> |
| 476 | - <p><?php _e('Use these shortcodes on the pages you want the forms to be displayed:', 'profilebuilder'); ?></p> | |
| 1208 | + <p><?php _e('Use these shortcodes on the pages you want the forms to be displayed:', 'profile-builder'); ?></p> | |
| 477 | 1209 | <ul> |
| 478 | 1210 | <li><strong class="nowrap">[wppb-register]</strong></li> |
| 479 | 1211 | <li><strong class="nowrap">[wppb-edit-profile]</strong></li> |
| 480 | 1212 | <li><strong class="nowrap">[wppb-register role="author"]</strong></li> |
| 481 | 1213 | </ul> |
| 482 | - <p><?php _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.", 'profilebuilder'); ?></p> | |
| 1214 | + <p> | |
| 1215 | + <?php | |
| 1216 | + if( PROFILE_BUILDER == 'Profile Builder Pro' ) | |
| 1217 | + _e("If you're interested in displaying different fields in the registration and edit profile forms, please use the Multiple Registration & Edit Profile Forms Modules.", 'profile-builder'); | |
| 1218 | + else | |
| 1219 | + _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" ) | |
| 1220 | + ?> | |
| 1221 | + </p> | |
| 483 | 1222 | <?php |
| 484 | 1223 | } |
| 485 | 1224 | add_action('wck_metabox_content_wppb_manage_fields_info', 'wppb_add_content_before_manage_fields'); |
| 486 | 1225 | |
| @@ -501,4 +1240,142 @@ | ||
| 501 | 1240 | if ( $meta_name == 'wppb_manage_fields' ) |
| 502 | 1241 | echo "<script type=\"text/javascript\">wppb_edit_form_properties( '#container_wppb_manage_fields', 'update_container_wppb_manage_fields_".$element_id."' );</script>"; |
| 503 | 1242 | } |
| 504 | 1243 | add_action("wck_after_adding_form", "wppb_remove_properties_from_added_form", 10, 3); |
| 1244 | + | |
| 1245 | +/* | |
| 1246 | + * WPML Support for dynamic strings in Profile Builder. Tags: WPML, fields, translate | |
| 1247 | + */ | |
| 1248 | +add_filter( 'update_option_wppb_manage_fields', 'wppb_wpml_compat_with_fields', 10, 2 ); | |
| 1249 | +function wppb_wpml_compat_with_fields( $oldvalue, $_newvalue ){ | |
| 1250 | + $default_fields = array( | |
| 1251 | + 'Default - Name (Heading)', | |
| 1252 | + 'Default - Contact Info (Heading)', | |
| 1253 | + 'Default - About Yourself (Heading)', | |
| 1254 | + 'Default - Username', | |
| 1255 | + 'Default - First Name', | |
| 1256 | + 'Default - Last Name', | |
| 1257 | + 'Default - Nickname', | |
| 1258 | + 'Default - E-mail', | |
| 1259 | + 'Default - Website', | |
| 1260 | + 'Default - AIM', | |
| 1261 | + 'Default - Yahoo IM', | |
| 1262 | + 'Default - Jabber / Google Talk', | |
| 1263 | + 'Default - Password', | |
| 1264 | + 'Default - Repeat Password', | |
| 1265 | + 'Default - Biographical Info', | |
| 1266 | + 'Default - Blog Details', | |
| 1267 | + 'Default - Display name publicly as' | |
| 1268 | + ); | |
| 1269 | + | |
| 1270 | + if ( is_array( $_newvalue ) ){ | |
| 1271 | + foreach ( $_newvalue as $field ){ | |
| 1272 | + if ( in_array($field['field'], $default_fields) ){ | |
| 1273 | + $prefix = 'default_field_'; | |
| 1274 | + } else { | |
| 1275 | + $prefix = 'custom_field_'; | |
| 1276 | + } | |
| 1277 | + if (function_exists('icl_register_string')){ | |
| 1278 | + if( !empty( $field['field-title'] ) ) | |
| 1279 | + icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_title_translation' , $field['field-title'] ); | |
| 1280 | + if( !empty( $field['description'] ) ) | |
| 1281 | + icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_description_translation', $field['description'] ); | |
| 1282 | + if( !empty( $field['labels'] ) ) | |
| 1283 | + icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_labels_translation', $field['labels'] ); | |
| 1284 | + if( !empty( $field['default-value'] ) ) | |
| 1285 | + icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_default_value_translation', $field['default-value'] ); | |
| 1286 | + if( !empty( $field['default-content'] ) ) | |
| 1287 | + icl_register_string('plugin profile-builder-pro', $prefix . $field['id'].'_default_content_translation', $field['default-content'] ); | |
| 1288 | + } | |
| 1289 | + } | |
| 1290 | + } | |
| 1291 | +} | |
| 1292 | + | |
| 1293 | + | |
| 1294 | +/* | |
| 1295 | + * Returns the HTML for a map given the field | |
| 1296 | + * | |
| 1297 | + */ | |
| 1298 | +function wppb_get_map_output( $field, $args ) { | |
| 1299 | + | |
| 1300 | + $defaults = array( | |
| 1301 | + 'markers' => array(), | |
| 1302 | + 'editable' => true, | |
| 1303 | + 'show_search' => true, | |
| 1304 | + 'extra_attr' => '' | |
| 1305 | + ); | |
| 1306 | + | |
| 1307 | + $args = wp_parse_args( $args, $defaults ); | |
| 1308 | + | |
| 1309 | + $return = ''; | |
| 1310 | + | |
| 1311 | + // Search box | |
| 1312 | + // The style:left=-99999px is set to hide the input from the viewport. It will be rewritten when the map gets initialised | |
| 1313 | + if( $args['show_search'] ) | |
| 1314 | + $return .= '<input style="left: -99999px" type="text" id="' . $field['meta-name'] . '-search-box" class="wppb-map-search-box" placeholder="' . __( 'Search Location', 'profile-builder' ) . '" />'; | |
| 1315 | + | |
| 1316 | + // Map container | |
| 1317 | + $return .= '<div id="' . $field['meta-name'] . '" class="wppb-map-container" style="height: ' . $field['map-height'] . 'px;" data-editable="' . ( $args['editable'] ? 1 : 0 ) . '" data-default-zoom="' . ( !empty( $field['map-default-zoom'] ) ? (int)$field['map-default-zoom'] : 16 ) . '" data-default-lat="' . $field['map-default-lat'] . '" data-default-lng="' . $field['map-default-lng'] . '" ' . $args['extra_attr'] . '></div>'; | |
| 1318 | + | |
| 1319 | + if( !empty( $args['markers'] ) ) { | |
| 1320 | + foreach( $args['markers'] as $marker ) | |
| 1321 | + $return .= '<input name="' . $field['meta-name'] . '[]" type="hidden" class="wppb-map-marker" value="' . $marker . '" />'; | |
| 1322 | + } | |
| 1323 | + | |
| 1324 | + return $return; | |
| 1325 | + | |
| 1326 | +} | |
| 1327 | + | |
| 1328 | + | |
| 1329 | +/* | |
| 1330 | + * Returns all the saved markers for a map field for a particular user | |
| 1331 | + * | |
| 1332 | + */ | |
| 1333 | +function wppb_get_user_map_markers( $user_id, $meta_name ) { | |
| 1334 | + | |
| 1335 | + global $wpdb; | |
| 1336 | + | |
| 1337 | + $meta_name_underlined = $meta_name . '_'; | |
| 1338 | + | |
| 1339 | + $results = $wpdb->get_results( "SELECT meta_value, meta_key FROM {$wpdb->usermeta} WHERE user_id={$user_id} AND meta_key LIKE '%{$meta_name_underlined}%'", ARRAY_N ); | |
| 1340 | + | |
| 1341 | + $markers = array(); | |
| 1342 | + $i = 0; | |
| 1343 | + | |
| 1344 | + foreach( $results as $key => $result ) { | |
| 1345 | + $pattern = '/^' . $meta_name . '_[0-9]+$/'; | |
| 1346 | + preg_match( $pattern, $result[1], $matches ); | |
| 1347 | + if ( count ($matches) > 0 ) { | |
| 1348 | + $markers[$i] = $result[0]; | |
| 1349 | + $i++; | |
| 1350 | + } | |
| 1351 | + | |
| 1352 | + } | |
| 1353 | + return $markers; | |
| 1354 | + | |
| 1355 | +} | |
| 1356 | + | |
| 1357 | +/* | |
| 1358 | + * Deletes from the database all saved markers | |
| 1359 | + * | |
| 1360 | + */ | |
| 1361 | +function wppb_delete_user_map_markers( $user_id, $meta_name ) { | |
| 1362 | + | |
| 1363 | + global $wpdb; | |
| 1364 | + | |
| 1365 | + $meta_name .= '_'; | |
| 1366 | + | |
| 1367 | + $delete = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->usermeta} WHERE user_id=%d AND meta_key LIKE %s", $user_id, '%' . $meta_name . '%' ) ); | |
| 1368 | + | |
| 1369 | + wp_cache_delete( $user_id, 'user_meta' ); | |
| 1370 | + | |
| 1371 | +} | |
| 1372 | + | |
| 1373 | +/** | |
| 1374 | + * Disable the add button again after we added a field | |
| 1375 | + */ | |
| 1376 | +add_action( 'wck_ajax_add_form_wppb_manage_fields', 'wppb_redisable_the_add_button' ); | |
| 1377 | +function wppb_redisable_the_add_button(){ | |
| 1378 | + ?> | |
| 1379 | + <script>wppb_disable_add_entry_button ( '#wppb_manage_fields' );</script> | |
| 1380 | + <?php | |
| 1381 | +} | |