From 9d83fd7b62b0f3e4ff8415cfd57c909bab7b2e15 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 30 Jun 2024 10:06:55 +0900 Subject: [PATCH 1/3] docs: change rule order Alphabetical order. --- .../source/libraries/validation.rst | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 899389d2d004..88db25b81db8 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -897,15 +897,11 @@ Rule Parameter Description ======================= ========== ============================================= =================================================== alpha No Fails if field has anything other than alphabetic characters in ASCII. -alpha_space No Fails if field contains anything other than - alphabetic characters or spaces in ASCII. alpha_dash No Fails if field contains anything other than alphanumeric characters, underscores or dashes in ASCII. alpha_numeric No Fails if field contains anything other than alphanumeric characters in ASCII. -alpha_numeric_space No Fails if field contains anything other than - alphanumeric or space characters in ASCII. alpha_numeric_punct No Fails if field contains anything other than alphanumeric, space, or this limited set of punctuation characters: ``~`` (tilde), @@ -916,6 +912,10 @@ alpha_numeric_punct No Fails if field contains anything other than ``_`` (underscore), ``+`` (plus), ``=`` (equals), ``|`` (vertical bar), ``:`` (colon), ``.`` (period). +alpha_numeric_space No Fails if field contains anything other than + alphanumeric or space characters in ASCII. +alpha_space No Fails if field contains anything other than + alphabetic characters or spaces in ASCII. decimal No Fails if field contains anything other than a decimal number. Also accepts a ``+`` or ``-`` sign for the number. @@ -964,10 +964,10 @@ not_in_list Yes Fails if field is within a predetermined list. numeric No Fails if field contains anything other than numeric characters. -regex_match Yes Fails if field does not match the regular ``regex_match[/regex/]`` - expression. permit_empty No Allows the field to receive an empty array, empty string, null or false. +regex_match Yes Fails if field does not match the regular ``regex_match[/regex/]`` + expression. required No Fails if the field is an empty array, empty string, null or false. required_with Yes The field is required when any of the other ``required_with[field1,field2]`` @@ -980,31 +980,6 @@ timezone No Fails if field does not match a timezone per `timezone_identifiers_list()`_ valid_base64 No Fails if field contains anything other than valid Base64 characters. -valid_json No Fails if field does not contain a valid JSON - string. -valid_email No Fails if field does not contain a valid - email address. -valid_emails No Fails if any value provided in a comma - separated list is not a valid email. -valid_ip Yes Fails if the supplied IP is not valid. ``valid_ip[ipv6]`` - Accepts an optional parameter of ``ipv4`` or - ``ipv6`` to specify an IP format. -valid_url No Fails if field does not contain (loosely) a - URL. Includes simple strings that could be - hostnames, like "codeigniter". - **Normally,** ``valid_url_strict`` **should - be used.** -valid_url_strict Yes Fails if field does not contain a valid URL. ``valid_url_strict[https]`` - You can optionally specify a list of valid - schemas. If not specified, ``http,https`` - are valid. This rule uses PHP's - ``FILTER_VALIDATE_URL``. -valid_date Yes Fails if field does not contain a valid date. ``valid_date[d/m/Y]`` - Any string that `strtotime()`_ accepts is - valid if you don't specify an optional - parameter that matches a date format. - **So it is usually necessary to specify - the parameter.** valid_cc_number Yes Verifies that the credit card number matches ``valid_cc_number[amex]`` the format used by the specified provider. Current supported providers are: @@ -1025,6 +1000,31 @@ valid_cc_number Yes Verifies that the credit card number matches Scotiabank Scotia Card (``scotia``), BMO ABM Card (``bmoabm``), HSBC Canada Card (``hsbc``) +valid_date Yes Fails if field does not contain a valid date. ``valid_date[d/m/Y]`` + Any string that `strtotime()`_ accepts is + valid if you don't specify an optional + parameter that matches a date format. + **So it is usually necessary to specify + the parameter.** +valid_email No Fails if field does not contain a valid + email address. +valid_emails No Fails if any value provided in a comma + separated list is not a valid email. +valid_ip Yes Fails if the supplied IP is not valid. ``valid_ip[ipv6]`` + Accepts an optional parameter of ``ipv4`` or + ``ipv6`` to specify an IP format. +valid_json No Fails if field does not contain a valid JSON + string. +valid_url No Fails if field does not contain (loosely) a + URL. Includes simple strings that could be + hostnames, like "codeigniter". + **Normally,** ``valid_url_strict`` **should + be used.** +valid_url_strict Yes Fails if field does not contain a valid URL. ``valid_url_strict[https]`` + You can optionally specify a list of valid + schemas. If not specified, ``http,https`` + are valid. This rule uses PHP's + ``FILTER_VALIDATE_URL``. ======================= ========== ============================================= =================================================== .. note:: You can also use any native PHP functions that return boolean and From 0e56433deb12ee9e36361a4a7182c10b17377239 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 30 Jun 2024 10:13:45 +0900 Subject: [PATCH 2/3] docs: decorate words --- user_guide_src/source/libraries/validation.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 88db25b81db8..7a6035734c1f 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -940,9 +940,11 @@ in_list Yes Fails if field is not within a predetermined integer No Fails if field contains anything other than an integer. is_natural No Fails if field contains anything other than - a natural number: 0, 1, 2, 3, etc. + a natural number: ``0``, ``1``, ``2``, ``3`` + , etc. is_natural_no_zero No Fails if field contains anything other than - a natural number, except zero: 1, 2, 3, etc. + a natural number, except zero: ``1``, ``2``, + ``3``, etc. is_not_unique Yes Checks the database to see if the given value ``is_not_unique[table.field,where_field,where_value]`` exists. Can ignore records by field/value to filter (currently accept only one filter). @@ -974,7 +976,7 @@ required_with Yes The field is required when any of the other fields is not `empty()`_ in the data. required_without Yes The field is required when any of the other ``required_without[field1,field2]`` fields is `empty()`_ in the data. -string No A generic alternative to the alpha* rules +string No A generic alternative to the **alpha*** rules that confirms the element is a string timezone No Fails if field does not match a timezone per `timezone_identifiers_list()`_ From 6938f4a74838a0555ed447978a082025fc8ff7d7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 30 Jun 2024 10:18:05 +0900 Subject: [PATCH 3/3] docs: add important note --- user_guide_src/source/libraries/validation.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 7a6035734c1f..7b87954653e1 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -1031,7 +1031,8 @@ valid_url_strict Yes Fails if field does not contain a valid URL. .. note:: You can also use any native PHP functions that return boolean and permit at least one parameter, the field data to validate. - The Validation library **never alters the data** to validate. + +.. important:: The Validation library **never alters the data** to validate. .. _timezone_identifiers_list(): https://www.php.net/manual/en/function.timezone-identifiers-list.php .. _strtotime(): https://www.php.net/manual/en/function.strtotime.php