hValidate.php

The hValidate.php helper provides a collection of functions to validate various types of user input in Osclass. These functions ensure that text, numbers, URLs, emails, phone numbers, and other data meet required formats and constraints before further processing.

Functions Description

osc_validate_text($value = '', $count = 1, $required = true) – Validates text input by ensuring it contains at least a minimum number of non-punctuation characters. This is useful for international text validation.

osc_validate_int($value) – Validates that the provided value consists solely of numeric digits without any periods.

osc_validate_nozero($value) – Validates that the value represents a number greater than zero (with no periods allowed).

osc_validate_number($value = null, $required = false) – Validates that the provided value is a number or a numeric string.

osc_validate_phone($value = null, $count = 10, $required = false) – Validates that the provided value is a valid phone number. It expects a 10-digit number and supports common phone number formats.

osc_validate_min($value = null, $min = 6) – Validates that the length or numeric value of the provided input is greater than the specified minimum.

osc_validate_max($value = null, $max = 255) – Validates that the length or numeric value of the provided input is less than the specified maximum.

osc_validate_range($value, $min = 6, $max = 255) – Validates that the provided value falls within the inclusive range defined by the minimum and maximum values.

osc_validate_location($city, $sCity, $region, $sRegion, $country, $sCountry) – Validates that the specified city, region, and country exist in the database. This function helps ensure that location-based data is accurate.

osc_validate_category($value) – Validates that the specified category exists and is enabled in the database.

osc_validate_url($value, $required = false) – Validates that the provided value is a properly formatted URL.

osc_validate_spam_delay($type = 'item') – Validates the delay between two successive submissions (such as item postings or comments) to help prevent spam.

osc_validate_email($email, $required = true) – Validates that the provided email address is in a correct format.

osc_validate_username($value, $min = 1) – Validates that the provided username meets the minimum length requirement.