| @@ -42,10 +42,10 @@ | ||
| 42 | 42 | $errors['short_description'][] = __('Short description cannot exceed 500 characters', 'yatra'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if (isset($data['slug']) && !empty($data['slug'])) { |
| 46 | - if (!preg_match('/^[a-z0-9-]+$/', $data['slug'])) { | |
| 47 | - $errors['slug'][] = __('Slug can only contain lowercase letters, numbers, and hyphens', 'yatra'); | |
| 46 | + if (!preg_match('/^[\pL\pN-]+$/u', $data['slug'])) { | |
| 47 | + $errors['slug'][] = __('Slug can only contain letters, numbers, and hyphens', 'yatra'); | |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (isset($data['country_code']) && !empty($data['country_code'])) { |
| @@ -128,10 +128,10 @@ | ||
| 128 | 128 | if (isset($data['short_description']) && strlen($data['short_description']) > 500) { |
| 129 | 129 | $errors['short_description'][] = __('Short description cannot exceed 500 characters', 'yatra'); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if (isset($data['slug']) && !empty($data['slug']) && !preg_match('/^[a-z0-9-]+$/', $data['slug'])) { | |
| 133 | - $errors['slug'][] = __('Slug can only contain lowercase letters, numbers, and hyphens', 'yatra'); | |
| 132 | + if (isset($data['slug']) && !empty($data['slug']) && !preg_match('/^[\pL\pN-]+$/u', $data['slug'])) { | |
| 133 | + $errors['slug'][] = __('Slug can only contain letters, numbers, and hyphens', 'yatra'); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (isset($data['country_code']) && !empty($data['country_code']) && !preg_match('/^[A-Z]{2}$/', $data['country_code'])) { |
| 137 | 137 | $errors['country_code'][] = __('Country code must be 2 uppercase letters', 'yatra'); |
| @@ -187,9 +187,9 @@ | ||
| 187 | 187 | $sanitized['name'] = sanitize_text_field($data['name']); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if (isset($data['slug'])) { |
| 191 | - $sanitized['slug'] = sanitize_title($data['slug']); | |
| 191 | + $sanitized['slug'] = \Yatra\Helpers\SlugHelper::generate($data['slug']); | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (isset($data['description'])) { |
| 195 | 195 | $sanitized['description'] = wp_kses_post($data['description']); |