Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion user_guide_src/source/changelogs/v4.0.0-alpha.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ PRs merged
- #1540 Update validation class User Guide
- #1530 database performance improvement : use foreach() when possible
- 2047b5a Don't run filters when using spark.
- #1539 remove mb_* (mb string usage) in CreditCardRules
- #1539 remove mb\_* (mb string usage) in CreditCardRules
- #1536 ext-json in composer.json
- #1525 remove unneeded try {} catch {}
- #1524 Test routes resource with 'websafe' option
Expand Down
36 changes: 20 additions & 16 deletions user_guide_src/source/database/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ Description of Values
**username** The username used to connect to the database. (``SQLite3`` does not use this.)
**password** The password used to connect to the database. (``SQLite3`` does not use this.)
**database** The name of the database you want to connect to.

.. note:: CodeIgniter doesn't support dots (``.``) in the table and column names.
Since v4.5.0, database names with dots are supported.
**DBDriver** The database driver name. The case must match the driver name.
You can set a fully qualified classname to use your custom driver.
Supported drivers: ``MySQLi``, ``Postgre``, ``SQLite3``, ``SQLSRV``, and ``OCI8``.
Expand All @@ -173,28 +170,35 @@ Description of Values
strict SQL while developing an application.
**port** The database port number - Empty string ``''`` for default port (or dynamic port with ``SQLSRV``).
**foreignKeys** (``SQLite3`` only) true/false (boolean) - Whether to enable Foreign Key constraint.

.. important:: SQLite3 Foreign Key constraint is disabled by default.
See `SQLite documentation <https://www.sqlite.org/pragma.html#pragma_foreign_keys>`_.
To enforce Foreign Key constraint, set this config item to true.
**busyTimeout** (``SQLite3`` only) milliseconds (int) - Sleeps for a specified amount of time when a table is locked.
**synchronous** (``SQLite3`` only) flag (int) - How strict SQLite will be at flushing to disk during transactions.
Use `null` to stay with the default setting. This can be used since v4.6.0.
**numberNative** (``MySQLi`` only) true/false (boolean) - Whether to enable MYSQLI_OPT_INT_AND_FLOAT_NATIVE.
**foundRows** (``MySQLi`` only) true/false (boolean) - Whether to enable MYSQLI_CLIENT_FOUND_ROWS.
**dateFormat** The default date/time formats as PHP's `DateTime format`_.
* ``date`` - date format
* ``datetime`` - date and time format
* ``datetime-ms`` - date and time with millisecond format
* ``datetime-us`` - date and time with microsecond format
* ``time`` - time format
This can be used since v4.5.0, and you can get the value, e.g., ``$db->dateFormat['datetime']``.
Currently, the database drivers do not use these values directly,
but :ref:`Model <model-saving-dates>` uses them.
**dateFormat** The default date/time formats as PHP's `DateTime format`_, with the keys listed below the table.
================ ===========================================================================================================

.. _DateTime format: https://www.php.net/manual/en/datetime.format.php

.. note:: CodeIgniter doesn't support dots (``.``) in the table and column names.
Since v4.5.0, database names with dots are supported.

.. important:: SQLite3 Foreign Key constraint is disabled by default.
See `SQLite documentation <https://www.sqlite.org/pragma.html#pragma_foreign_keys>`_.
To enforce Foreign Key constraint, set **foreignKeys** to true.

The **dateFormat** array has the following keys:

* ``date`` - date format
* ``datetime`` - date and time format
* ``datetime-ms`` - date and time with millisecond format
* ``datetime-us`` - date and time with microsecond format
* ``time`` - time format

This can be used since v4.5.0, and you can get the value, e.g., ``$db->dateFormat['datetime']``.
Currently, the database drivers do not use these values directly,
but :ref:`Model <model-saving-dates>` uses them.

.. note:: Depending on what database driver you are using (``MySQLi``, ``Postgre``,
etc.) not all values will be needed. For example, when using ``SQLite3`` you
will not need to supply a username or password, and the database name
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/installation/upgrade_migrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Search & Replace
You can use to following table to search & replace your old CI3 files.

+------------------------------+----------------------------+
| Search | Replace |
| Search | Replace |
+==============================+============================+
| extends CI_Migration | extends Migration |
+------------------------------+----------------------------+
Expand Down
70 changes: 35 additions & 35 deletions user_guide_src/source/libraries/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1082,41 +1082,41 @@ See also :ref:`file-upload-form-tutorial`.
======================= ========== ============================================= ===================================================
Rule Parameter Description Example
======================= ========== ============================================= ===================================================
uploaded Yes Fails if the name of the parameter does not ``uploaded[field_name]``
match the name of any uploaded files.
If you want the file upload to be optional
(not required), do not define this rule.

max_size Yes Fails if the uploaded file is larger ``max_size[field_name,2048]``
than the second parameter
in kilobytes (kb). Or if the file
is larger than allowed maximum size declared
in php.ini config file -
``upload_max_filesize`` directive.
max_dims Yes Fails if the maximum width and height of an ``max_dims[field_name,300,150]``
uploaded image exceed values. The first
parameter is the field name. The second is
the width, and the third is the height. Will
also fail if the file cannot be determined
to be an image or the upload failed with an
error other than ``UPLOAD_ERR_NO_FILE``.
min_dims Yes Fails if the minimum width and height of an ``min_dims[field_name,300,150]``
uploaded image not meet values. The first
parameter is the field name. The second is
the width, and the third is the height. Will
also fail if the file cannot be determined
to be an image or the upload failed with an
error other than ``UPLOAD_ERR_NO_FILE``.
(This rule was added in
v4.6.0.)
mime_in Yes Fails if the file's mime type is not one ``mime_in[field_name,image/png,image/jpeg]``
listed in the parameters.
ext_in Yes Fails if the client filename's extension is ``ext_in[field_name,png,jpg,gif]``
not one listed in the parameters, or if the
detected MIME type does not match the MIME
types associated with the extension.
is_image Yes Fails if the file cannot be determined to be ``is_image[field_name]``
an image based on the mime type.
uploaded Yes Fails if the name of the parameter does not ``uploaded[field_name]``
match the name of any uploaded files.
If you want the file upload to be optional
(not required), do not define this rule.

max_size Yes Fails if the uploaded file is larger ``max_size[field_name,2048]``
than the second parameter
in kilobytes (kb). Or if the file
is larger than allowed maximum size declared
in php.ini config file -
``upload_max_filesize`` directive.
max_dims Yes Fails if the maximum width and height of an ``max_dims[field_name,300,150]``
uploaded image exceed values. The first
parameter is the field name. The second is
the width, and the third is the height. Will
also fail if the file cannot be determined
to be an image or the upload failed with an
error other than ``UPLOAD_ERR_NO_FILE``.
min_dims Yes Fails if the minimum width and height of an ``min_dims[field_name,300,150]``
uploaded image not meet values. The first
parameter is the field name. The second is
the width, and the third is the height. Will
also fail if the file cannot be determined
to be an image or the upload failed with an
error other than ``UPLOAD_ERR_NO_FILE``.
(This rule was added in
v4.6.0.)
mime_in Yes Fails if the file's mime type is not one ``mime_in[field_name,image/png,image/jpeg]``
listed in the parameters.
ext_in Yes Fails if the client filename's extension is ``ext_in[field_name,png,jpg,gif]``
not one listed in the parameters, or if the
detected MIME type does not match the MIME
types associated with the extension.
is_image Yes Fails if the file cannot be determined to be ``is_image[field_name]``
an image based on the mime type.
======================= ========== ============================================= ===================================================

The file validation rules apply for both single and multiple file uploads.
Expand Down
7 changes: 3 additions & 4 deletions user_guide_src/source/models/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1039,10 +1039,9 @@ afterUpdate **id** = the array of primary keys of the rows being passed to
**data** = the key/value pairs being updated.
**result** = the results of the ``update()`` method used through the Query Builder.
beforeFind The name of the calling **method**, whether a **singleton** was requested, and these additional fields:
- ``first()`` No additional fields
- ``find()`` **id** = the primary key of the row being searched for.
- ``findAll()`` **limit** = the number of rows to find.
**offset** = the number of rows to skip during the search.
none for ``first()``, **id** = the primary key of the row being searched for, for ``find()``,
and **limit** = the number of rows to find, and **offset** = the number of rows to skip during
the search, for ``findAll()``.
afterFind Same as **beforeFind** but including the resulting row(s) of data, or null if no result found.
beforeDelete **id** = an array of primary key rows being passed to the ``delete()`` method.
**purge** = boolean whether soft-delete rows should be hard deleted.
Expand Down
57 changes: 29 additions & 28 deletions user_guide_src/source/outgoing/view_parser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -438,63 +438,64 @@ Provided Filters
The following filters are available when using the parser:

================ ================= =========================================================== ======================================
Filter Arguments Description Example
Filter Arguments Description Example
================ ================= =========================================================== ======================================
abs Displays the absolute value of a number. { v|abs }
abs Displays the absolute value of a number. ``{ v|abs }``

capitalize Displays the string in sentence case: all lowercase { v|capitalize}
capitalize Displays the string in sentence case: all lowercase ``{ v|capitalize}``
with firstletter capitalized.

date format (Y-m-d) A PHP **date**-compatible formatting string. { v|date(Y-m-d) }
date format (Y-m-d) A PHP **date**-compatible formatting string. ``{ v|date(Y-m-d) }``

date_modify value to add A **strtotime** compatible string to modify the date, { v|date_modify(+1 day) }
/ subtract like ``+5 day`` or ``-1 week``.
date_modify value to add A **strtotime** compatible string to modify the date, ``{ v|date_modify(+1 day) }``
/ subtract like ``+5 day`` or ``-1 week``.

default default value Displays the default value if the variable is `empty()`_. { v|default(just in case) }
default default value Displays the default value if the variable is `empty()`_. ``{ v|default(just in case) }``

esc html, attr, Specifies the context to escape the data. { v|esc(attr) }
css, js
esc html, attr, Specifies the context to escape the data. ``{ v|esc(attr) }``
css, js

excerpt phrase, radius Returns the text within a radius of words from a given { v|excerpt(green giant, 20) }
excerpt phrase, radius Returns the text within a radius of words from a given ``{ v|excerpt(green giant, 20) }``
phrase. Same as **excerpt** helper function.

highlight phrase Highlights a given phrase within the text using { v|highlight(view parser) }
'<mark></mark>' tags.
highlight phrase Highlights a given phrase within the text using ``{ v|highlight(view parser) }``
``<mark></mark>`` tags.

highlight_code Highlights code samples with HTML/CSS. { v|highlight_code }
highlight_code Highlights code samples with HTML/CSS. ``{ v|highlight_code }``

limit_chars limit Limits the number of characters to $limit. { v|limit_chars(100) }
limit_chars limit Limits the number of characters to $limit. ``{ v|limit_chars(100) }``

limit_words limit Limits the number of words to $limit. { v|limit_words(20) }
limit_words limit Limits the number of words to $limit. ``{ v|limit_words(20) }``

local_currency currency, Displays a localized version of a currency. "currency" { v|local_currency(EUR,en_US) }
locale, valueis any 3-letter ISO 4217 currency code.
fraction
local_currency currency, Displays a localized version of a currency. "currency" ``{ v|local_currency(EUR,en_US) }``
locale, valueis any 3-letter ISO 4217 currency code.
fraction

local_number type, precision, Displays a localized version of a number. "type" can be { v|local_number(decimal,2,en_US) }
locale one of: decimal, currency, percent, scientific, spellout,
local_number type, precision, Displays a localized version of a number. "type" can be ``{ v|local_number(decimal,2,en_US) }``
locale one of: decimal, currency, percent, scientific, spellout,
ordinal, duration.

lower Converts a string to lowercase. { v|lower }
lower Converts a string to lowercase. ``{ v|lower }``

nl2br Replaces all newline characters (\n) to an HTML <br/> tag. { v|nl2br }
nl2br Replaces all newline characters (``\n``) to an HTML ``{ v|nl2br }``
``<br/>`` tag.

number_format places Wraps PHP **number_format** function for use within the { v|number_format(3) }
number_format places Wraps PHP **number_format** function for use within the ``{ v|number_format(3) }``
parser.

prose Takes a body of text and uses the **auto_typography()** { v|prose }
prose Takes a body of text and uses the **auto_typography()** ``{ v|prose }``
method to turn it into prettier, easier-to-read, prose.

round places, type Rounds a number to the specified places. Types of **ceil** { v|round(3) } { v|round(ceil) }
round places, type Rounds a number to the specified places. Types of **ceil** ``{ v|round(3) }`` ``{ v|round(ceil) }``
and **floor** can be passed to use those functions instead.

strip_tags allowed chars Wraps PHP **strip_tags**. Can accept a string of allowed { v|strip_tags(<br>) }
strip_tags allowed chars Wraps PHP **strip_tags**. Can accept a string of allowed ``{ v|strip_tags(<br>) }``
tags.

title Displays a "title case" version of the string, with all { v|title }
title Displays a "title case" version of the string, with all ``{ v|title }``
lowercase, and each word capitalized.

upper Displays the string in all uppercase. { v|upper }
upper Displays the string in all uppercase. ``{ v|upper }``
================ ================= =========================================================== ======================================

.. _empty(): https://www.php.net/manual/en/function.empty.php
Expand Down