| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* validation_rule_settings |
| 5 |
* |
| 6 |
* Returns an array of countries and codes. |
| 7 |
* |
| 8 |
* @author WooThemes |
| 9 |
* |
| 10 |
* @category i18n |
| 11 |
* @package fluentform/i18n |
| 12 |
* |
| 13 |
* @version 2.5.0 |
| 14 |
*/ |
| 15 |
if (! defined('ABSPATH')) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
$fluentformFileTypeOptions = [ |
| 20 |
[ |
| 21 |
'label' => __('Images (jpg, jpeg, gif, png, bmp)', 'fluentform'), |
| 22 |
'value' => 'jpg|jpeg|gif|png|bmp', |
| 23 |
], |
| 24 |
[ |
| 25 |
'label' => __('Audio (mp3, wav, ogg, oga, wma, mka, m4a, ra, mid, midi)', 'fluentform'), |
| 26 |
'value' => 'mp3|wav|ogg|oga|wma|mka|m4a|ra|mid|midi|mpga', |
| 27 |
], |
| 28 |
[ |
| 29 |
'label' => __('Video (avi, divx, flv, mov, ogv, mkv, mp4, m4v, divx, mpg, mpeg, mpe)', 'fluentform'), |
| 30 |
'value' => 'avi|divx|flv|mov|ogv|mkv|mp4|m4v|divx|mpg|mpeg|mpe|video/quicktime|qt', |
| 31 |
], |
| 32 |
[ |
| 33 |
'label' => __('PDF (pdf)', 'fluentform'), |
| 34 |
'value' => 'pdf', |
| 35 |
], |
| 36 |
[ |
| 37 |
'label' => __('Docs (doc, ppt, pps, xls, mdb, docx, xlsx, pptx, odt, odp, ods, odg, odc, odb, odf, rtf, txt)', 'fluentform'), |
| 38 |
'value' => 'doc|ppt|pps|xls|mdb|docx|xlsx|pptx|odt|odp|ods|odg|odc|odb|odf|rtf|txt', |
| 39 |
], |
| 40 |
[ |
| 41 |
'label' => __('Zip Archives (zip, gz, gzip, rar, 7z)', 'fluentform'), |
| 42 |
'value' => 'zip|gz|gzip|rar|7z', |
| 43 |
], |
| 44 |
[ |
| 45 |
'label' => __('Executable Files (exe)', 'fluentform'), |
| 46 |
'value' => 'exe', |
| 47 |
], |
| 48 |
[ |
| 49 |
'label' => __('CSV (csv)', 'fluentform'), |
| 50 |
'value' => 'csv', |
| 51 |
], |
| 52 |
]; |
| 53 |
|
| 54 |
$fluentformFileTypeOptions = apply_filters_deprecated( |
| 55 |
'fluentform_file_type_options', |
| 56 |
[ |
| 57 |
$fluentformFileTypeOptions |
| 58 |
], |
| 59 |
FLUENTFORM_FRAMEWORK_UPGRADE, |
| 60 |
'fluentform/file_type_options', |
| 61 |
'Use fluentform/file_type_options instead of fluentform_file_type_options.' |
| 62 |
); |
| 63 |
|
| 64 |
$fluentformFileTypeOptions = apply_filters('fluentform/file_type_options', $fluentformFileTypeOptions); |
| 65 |
|
| 66 |
$fluentformImageTypeOptions = [ |
| 67 |
[ |
| 68 |
'label' => __('JPG', 'fluentform'), |
| 69 |
'value' => 'jpg|jpeg', |
| 70 |
], |
| 71 |
[ |
| 72 |
'label' => __('PNG', 'fluentform'), |
| 73 |
'value' => 'png', |
| 74 |
], |
| 75 |
[ |
| 76 |
'label' => __('GIF', 'fluentform'), |
| 77 |
'value' => 'gif', |
| 78 |
], |
| 79 |
]; |
| 80 |
|
| 81 |
$fluentformImageTypeOptions = apply_filters('fluentform/image_type_options', $fluentformImageTypeOptions); |
| 82 |
|
| 83 |
$fluentformValidationRuleSettings = [ |
| 84 |
'required' => [ |
| 85 |
'template' => 'inputRadio', |
| 86 |
'label' => __('Required', 'fluentform'), |
| 87 |
'help_text' => __('Select whether this field is a required field for the form or not.', 'fluentform'), |
| 88 |
'options' => [ |
| 89 |
[ |
| 90 |
'value' => true, |
| 91 |
'label' => __('Yes', 'fluentform'), |
| 92 |
], |
| 93 |
[ |
| 94 |
'value' => false, |
| 95 |
'label' => __('No', 'fluentform'), |
| 96 |
], |
| 97 |
], |
| 98 |
], |
| 99 |
'valid_phone_number' => [ |
| 100 |
'template' => 'inputRadio', |
| 101 |
'label' => __('Validate Phone Number', 'fluentform'), |
| 102 |
'help_text' => __('Select whether the phone number should be validated or not.', 'fluentform'), |
| 103 |
'options' => [ |
| 104 |
[ |
| 105 |
'value' => true, |
| 106 |
'label' => __('Yes', 'fluentform'), |
| 107 |
], |
| 108 |
[ |
| 109 |
'value' => false, |
| 110 |
'label' => __('No', 'fluentform'), |
| 111 |
], |
| 112 |
], |
| 113 |
], |
| 114 |
'email' => [ |
| 115 |
'template' => 'inputRadio', |
| 116 |
'label' => __('Validate Email', 'fluentform'), |
| 117 |
'help_text' => __('Select whether to validate this field as email or not', 'fluentform'), |
| 118 |
'options' => [ |
| 119 |
[ |
| 120 |
'value' => true, |
| 121 |
'label' => __('Yes', 'fluentform'), |
| 122 |
], |
| 123 |
[ |
| 124 |
'value' => false, |
| 125 |
'label' => __('No', 'fluentform'), |
| 126 |
], |
| 127 |
], |
| 128 |
], |
| 129 |
'url' => [ |
| 130 |
'template' => 'inputRadio', |
| 131 |
'label' => __('Validate URL', 'fluentform'), |
| 132 |
'help_text' => __('Select whether to validate this field as URL or not', 'fluentform'), |
| 133 |
'options' => [ |
| 134 |
[ |
| 135 |
'value' => true, |
| 136 |
'label' => __('Yes', 'fluentform'), |
| 137 |
], |
| 138 |
[ |
| 139 |
'value' => false, |
| 140 |
'label' => __('No', 'fluentform'), |
| 141 |
], |
| 142 |
], |
| 143 |
], |
| 144 |
'min' => [ |
| 145 |
'template' => 'inputText', |
| 146 |
'type' => 'number', |
| 147 |
'label' => __('Min Value', 'fluentform'), |
| 148 |
'help_text' => __('Minimum value for the input field.', 'fluentform'), |
| 149 |
], |
| 150 |
'digits' => [ |
| 151 |
'template' => 'inputText', |
| 152 |
'type' => 'number', |
| 153 |
'label' => __('Digits', 'fluentform'), |
| 154 |
'help_text' => __('Number of digits for the input field.', 'fluentform'), |
| 155 |
], |
| 156 |
'max' => [ |
| 157 |
'template' => 'inputText', |
| 158 |
'type' => 'number', |
| 159 |
'label' => __('Max Value', 'fluentform'), |
| 160 |
'help_text' => __('Maximum value for the input field.', 'fluentform'), |
| 161 |
], |
| 162 |
'max_selection' => [ |
| 163 |
'template' => 'inputText', |
| 164 |
'type' => 'number', |
| 165 |
'label' => __('Max Selection', 'fluentform'), |
| 166 |
'help_text' => __('The most options a user may select. Leave empty for no maximum.', 'fluentform'), |
| 167 |
], |
| 168 |
'min_selection' => [ |
| 169 |
'template' => 'inputText', |
| 170 |
'type' => 'number', |
| 171 |
'label' => __('Min Selection', 'fluentform'), |
| 172 |
'help_text' => __('The fewest options a user may select. Leave empty for no minimum. A user who selects nothing is treated as having skipped the field, so this does not make an optional field required.', 'fluentform'), |
| 173 |
], |
| 174 |
'max_file_size' => [ |
| 175 |
'template' => 'maxFileSize', |
| 176 |
'label' => __('Max File Size', 'fluentform'), |
| 177 |
'help_text' => __('The file size limit uploaded by the user.', 'fluentform'), |
| 178 |
], |
| 179 |
'max_file_count' => [ |
| 180 |
'template' => 'inputText', |
| 181 |
'type' => 'number', |
| 182 |
'label' => __('Max Files Count', 'fluentform'), |
| 183 |
'help_text' => __('Maximum user file upload number.', 'fluentform'), |
| 184 |
], |
| 185 |
'allowed_file_types' => [ |
| 186 |
'template' => 'inputCheckbox', |
| 187 |
'label' => __('Allowed Files', 'fluentform'), |
| 188 |
'help_text' => __('Allowed Files', 'fluentform'), |
| 189 |
'fileTypes' => [ |
| 190 |
[ |
| 191 |
'title' => __('Images', 'fluentform'), |
| 192 |
'types' => ['jpg', 'jpeg', 'gif', 'png', 'bmp'], |
| 193 |
], |
| 194 |
[ |
| 195 |
'title' => __('Audio', 'fluentform'), |
| 196 |
'types' => ['mp3', 'wav', 'ogg', 'oga', 'wma', 'mka', 'm4a', 'ra', 'mid', 'midi'], |
| 197 |
], |
| 198 |
[ |
| 199 |
'title' => __('Video', 'fluentform'), |
| 200 |
'types' => [ |
| 201 |
'avi', |
| 202 |
'divx', |
| 203 |
'flv', |
| 204 |
'mov', |
| 205 |
'ogv', |
| 206 |
'mkv', |
| 207 |
'mp4', |
| 208 |
'm4v', |
| 209 |
'divx', |
| 210 |
'mpg', |
| 211 |
'mpeg', |
| 212 |
'mpe', |
| 213 |
], |
| 214 |
], |
| 215 |
[ |
| 216 |
'title' => __('PDF', 'fluentform'), |
| 217 |
'types' => ['pdf'], |
| 218 |
], |
| 219 |
[ |
| 220 |
'title' => __('Docs', 'fluentform'), |
| 221 |
'types' => [ |
| 222 |
'doc', |
| 223 |
'ppt', |
| 224 |
'pps', |
| 225 |
'xls', |
| 226 |
'mdb', |
| 227 |
'docx', |
| 228 |
'xlsx', |
| 229 |
'pptx', |
| 230 |
'odt', |
| 231 |
'odp', |
| 232 |
'ods', |
| 233 |
'odg', |
| 234 |
'odc', |
| 235 |
'odb', |
| 236 |
'odf', |
| 237 |
'rtf', |
| 238 |
'txt', |
| 239 |
], |
| 240 |
], |
| 241 |
[ |
| 242 |
'title' => __('Zip Archives', 'fluentform'), |
| 243 |
'types' => ['zip', 'gz', 'gzip', 'rar', '7z', ], |
| 244 |
], |
| 245 |
[ |
| 246 |
'title' => __('Executable Files', 'fluentform'), |
| 247 |
'types' => ['exe'], |
| 248 |
], |
| 249 |
[ |
| 250 |
'title' => __('CSV', 'fluentform'), |
| 251 |
'types' => ['csv'], |
| 252 |
], |
| 253 |
], |
| 254 |
'options' => $fluentformFileTypeOptions, |
| 255 |
], |
| 256 |
'allowed_image_types' => [ |
| 257 |
'template' => 'inputCheckbox', |
| 258 |
'label' => __('Allowed Images', 'fluentform'), |
| 259 |
'help_text' => __('Allowed Images', 'fluentform'), |
| 260 |
'fileTypes' => [ |
| 261 |
[ |
| 262 |
'title' => __('JPG', 'fluentform'), |
| 263 |
'types' => ['jpg|jpeg', ], |
| 264 |
], |
| 265 |
[ |
| 266 |
'title' => __('PNG', 'fluentform'), |
| 267 |
'types' => ['png'], |
| 268 |
], |
| 269 |
[ |
| 270 |
'title' => __('GIF', 'fluentform'), |
| 271 |
'types' => ['gif'], |
| 272 |
], |
| 273 |
], |
| 274 |
'options' => $fluentformImageTypeOptions, |
| 275 |
], |
| 276 |
]; |
| 277 |
|
| 278 |
$fluentformValidationRuleSettings = apply_filters_deprecated( |
| 279 |
'fluent_editor_validation_rule_settings', |
| 280 |
[ |
| 281 |
$fluentformValidationRuleSettings |
| 282 |
], |
| 283 |
FLUENTFORM_FRAMEWORK_UPGRADE, |
| 284 |
'fluentform/editor_validation_rule_settings', |
| 285 |
'Use fluentform/editor_validation_rule_settings instead of fluent_editor_validation_rule_settings.' |
| 286 |
); |
| 287 |
|
| 288 |
return apply_filters('fluentform/editor_validation_rule_settings', $fluentformValidationRuleSettings); |
| 289 |
|