Smart.Framework Logo

final class \SmartValidator
{ } ::

Class: SmartValidator - provides misc validating methods.


class Methods

public static function regex_stringvalidation_expression ( ENUM $y_mode, ENUM $y_match = "full" ) {} :: STRING
@return: {STRING} The Regex expression or empty if invalid mode is provided
@param: {ENUM} $y_mode: The Regex mode to be returned ; valid modes
@param: {ENUM} $y_match: Match Type: full / partial
Regex Expressions for Text Parsing of: Numbers, IP addresses, Valid eMail Address with TLD domain, Phone (US), Unicode Text (UTF-8)
number-integer :: number integer: as -10 or 10
number-decimal :: number decimal: as -0.05 or 0.05
number-list-integer :: number, list integer: as 1;2;30 (numbers separed by semicolon=;)
number-list-decimal :: number, list decimal: as 1.0;2;30.44 (numbers separed by semicolon=;)
ipv4 :: IP (v4): 0.0.0.0 .. 255.255.255.255
ipv6 :: IP (v4): ::1 .. 2a00:1450:400c:c01::68 ...
email :: eMail@address.tld ; MUST contain a TLD ; TLD can be 2 letters long as well as 3 or more
phone-us :: US phone numbers
utf8-text :: Unicode (UTF-8) Text
public static function validate_string ( STRING $y_string, ENUM $y_mode ) {} :: BOOLEAN
@return: {BOOLEAN} TRUE if validated by regex ; FALSE if not validated
@param: {STRING} $y_string: The String to be validated
@param: {ENUM} $y_mode: The Regex mode to use for validation ; see reference for SmartValidator::regex_stringvalidation_expression()
Validate a string using SmartValidator::regex_stringvalidation_expression(), Full Match
public static function validate_numeric_integer_or_decimal_values ( STRING $val ) {} :: BOOL
@return: {BOOL} TRUE if Integer or Decimal (positive / negative) ; FALSE if not
@param: {STRING} $val: The string or number to be validated
Validate if a string or number is Integer or Decimal (positive / negative)
This will not check if the number is finite or overflowing !!
public static function validate_numeric_pure_valid_values ( STRING $val ) {} :: BOOL
@return: {BOOL} TRUE if match condition ; FALSE if not
@param: {STRING} $val: The string or number to be validated
Validate if a string or number is VALID numeric (finite, not overflowing, match precision, not Expressions like 1.3e3 ; may contain only -0123456789.)
public static function validate_integer_pure_valid_values ( STRING $val ) {} :: BOOL
@return: {BOOL} TRUE if match condition ; FALSE if not
@param: {STRING} $val: The string or number to be validated
Validate if a string or number is VALID integer (finite, not overflowing, match precision and max/min integer, not Expressions like 1.3e3 ; may contain only -0123456789)
public static function validate_html_or_xml_code ( STRING $y_html_or_xml_code ) {} :: BOOLEAN
@return: {BOOLEAN} TRUE (if XML or HTML tags are detected) or FALSE if not
@param: {STRING} $y_html_or_xml_code: The String to be tested
Detect HTML or XML code contain tags (if does not contain tags is not html or xml code ...)
public static function validate_filter_ip_address ( STRING $ip ) {} :: STRING
@return: {STRING} The IP address if valid (as string) or an empty string if Invalid
@param: {STRING} $ip: The IP Address to be validated
Validate and Filter an IP Address
public static function validate_mime_disposition ( STRING $y_disp ) {} :: STRING
@return: {STRING} The validated Mime Disposition
@param: {STRING} $y_disp: The Mime Disposition ; can be: inline / attachment / attachment; filename="somefile.pdf"
Validate The Mime Disposition
public static function validate_mime_type ( STRING $y_type ) {} :: STRING
@return: {STRING} The validated Mime Type
@param: {STRING} $y_type: The Mime Type ; Ex: image/png
Validate The Mime Type

class Properties


class Constants


Sample code: PHP

<?php

// Usage example:
 
SmartValidator::some_method_of_this_class(...);

// #end php code


documentation generated on: 2023-10-19 23:15:44 +0000


Smart.Framework © 2009-2023 unix-world.org