Skip to content

Commit

Permalink
reindent & fix some examples
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 committed Jan 7, 2021
1 parent 1cc2c83 commit e0b89a7
Show file tree
Hide file tree
Showing 14 changed files with 1,073 additions and 1,073 deletions.
2 changes: 1 addition & 1 deletion user_guide_src/source/helpers/array_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Loading this Helper

This helper is loaded using the following code::

helper('array');
helper('array');

Available Functions
===================
Expand Down
82 changes: 41 additions & 41 deletions user_guide_src/source/helpers/cookie_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Loading this Helper

This helper is loaded using the following code::

helper('cookie');
helper('cookie');

Available Functions
===================
Expand All @@ -26,54 +26,54 @@ The following functions are available:

.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = false[, $httpOnly = false[, $sameSite = '']]]]]]]])
:param mixed $name: Cookie name *or* associative array of all of the parameters available to this function
:param string $value: Cookie value
:param int $expire: Number of seconds until expiration
:param string $domain: Cookie domain (usually: .yourdomain.com)
:param string $path: Cookie path
:param string $prefix: Cookie name prefix
:param bool $secure: Whether to only send the cookie through HTTPS
:param bool $httpOnly: Whether to hide the cookie from JavaScript
:param string $sameSite: The value for the SameSite cookie parameter. If null, the default from `config/App.php` is used
:rtype: void

This helper function gives you friendlier syntax to set browser
cookies. Refer to the :doc:`Response Library </outgoing/response>` for
a description of its use, as this function is an alias for
``Response::setCookie()``.
:param mixed $name: Cookie name *or* associative array of all of the parameters available to this function
:param string $value: Cookie value
:param int $expire: Number of seconds until expiration
:param string $domain: Cookie domain (usually: .yourdomain.com)
:param string $path: Cookie path
:param string $prefix: Cookie name prefix
:param bool $secure: Whether to only send the cookie through HTTPS
:param bool $httpOnly: Whether to hide the cookie from JavaScript
:param string $sameSite: The value for the SameSite cookie parameter. If null, the default from `config/App.php` is used
:rtype: void

This helper function gives you friendlier syntax to set browser
cookies. Refer to the :doc:`Response Library </outgoing/response>` for
a description of its use, as this function is an alias for
``Response::setCookie()``.

.. php:function:: get_cookie($index[, $xssClean = false])
:param string $index: Cookie name
:param bool $xss_clean: Whether to apply XSS filtering to the returned value
:returns: The cookie value or NULL if not found
:rtype: mixed
:param string $index: Cookie name
:param bool $xss_clean: Whether to apply XSS filtering to the returned value
:returns: The cookie value or NULL if not found
:rtype: mixed

This helper function gives you friendlier syntax to get browser
cookies. Refer to the :doc:`IncomingRequest Library </incoming/incomingrequest>` for
detailed description of its use, as this function acts very
similarly to ``IncomingRequest::getCookie()``, except it will also prepend
the ``$cookiePrefix`` that you might've set in your
*app/Config/App.php* file.
This helper function gives you friendlier syntax to get browser
cookies. Refer to the :doc:`IncomingRequest Library </incoming/incomingrequest>` for
detailed description of its use, as this function acts very
similarly to ``IncomingRequest::getCookie()``, except it will also prepend
the ``$cookiePrefix`` that you might've set in your
*app/Config/App.php* file.

.. php:function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]])
:param string $name: Cookie name
:param string $domain: Cookie domain (usually: .yourdomain.com)
:param string $path: Cookie path
:param string $prefix: Cookie name prefix
:rtype: void
:param string $name: Cookie name
:param string $domain: Cookie domain (usually: .yourdomain.com)
:param string $path: Cookie path
:param string $prefix: Cookie name prefix
:rtype: void

Lets you delete a cookie. Unless you've set a custom path or other
values, only the name of the cookie is needed.
::
Lets you delete a cookie. Unless you've set a custom path or other
values, only the name of the cookie is needed.
::

delete_cookie('name');
delete_cookie('name');

This function is otherwise identical to ``set_cookie()``, except that it
does not have the value and expiration parameters. You can submit an
array of values in the first parameter or you can set discrete
parameters.
::
This function is otherwise identical to ``set_cookie()``, except that it
does not have the value and expiration parameters. You can submit an
array of values in the first parameter or you can set discrete
parameters.
::

delete_cookie($name, $domain, $path, $prefix);
delete_cookie($name, $domain, $path, $prefix);
50 changes: 25 additions & 25 deletions user_guide_src/source/helpers/date_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Loading this Helper

This helper is loaded using the following code::

helper('date');
helper('date');

Available Functions
===================
Expand All @@ -26,38 +26,38 @@ The following functions are available:

.. php:function:: now([$timezone = NULL])
:param string $timezone: Timezone
:returns: UNIX timestamp
:rtype: int
:param string $timezone: Timezone
:returns: UNIX timestamp
:rtype: int

Returns the current time as a UNIX timestamp, referenced either to your server's
local time or any PHP supported timezone, based on the "time reference" setting
in your config file. If you do not intend to set your master time reference to
any other PHP supported timezone (which you'll typically do if you run a site
that lets each user set their own timezone settings) there is no benefit to using
this function over PHP's ``time()`` function.
::
Returns the current time as a UNIX timestamp, referenced either to your server's
local time or any PHP supported timezone, based on the "time reference" setting
in your config file. If you do not intend to set your master time reference to
any other PHP supported timezone (which you'll typically do if you run a site
that lets each user set their own timezone settings) there is no benefit to using
this function over PHP's ``time()`` function.
::

echo now('Australia/Victoria');
echo now('Australia/Victoria');

If a timezone is not provided, it will return ``time()`` based on the
**time_reference** setting.
If a timezone is not provided, it will return ``time()`` based on the
**time_reference** setting.

.. php:function:: timezone_select([$class = '', $default = '', $what = \DateTimeZone::ALL, $country = null])
:param string $class: Optional class to apply to the select field
:param string $default: Default value for initial selection
:param int $what: DateTimeZone class constants (see `listIdentifiers <https://www.php.net/manual/en/datetimezone.listidentifiers.php>`_)
:param string $country: A two-letter ISO 3166-1 compatible country code (see `listIdentifiers <https://www.php.net/manual/en/datetimezone.listidentifiers.php>`_)
:returns: Preformatted HTML select field
:rtype: string
:param string $class: Optional class to apply to the select field
:param string $default: Default value for initial selection
:param int $what: DateTimeZone class constants (see `listIdentifiers <https://www.php.net/manual/en/datetimezone.listidentifiers.php>`_)
:param string $country: A two-letter ISO 3166-1 compatible country code (see `listIdentifiers <https://www.php.net/manual/en/datetimezone.listidentifiers.php>`_)
:returns: Preformatted HTML select field
:rtype: string

Generates a `select` form field of available timezones (optionally filtered by `$what` and `$country`).
You can supply an option class to apply to the field to make formatting easier, as well as a default
selected value.
::
Generates a `select` form field of available timezones (optionally filtered by `$what` and `$country`).
You can supply an option class to apply to the field to make formatting easier, as well as a default
selected value.
::

echo timezone_select('custom-select', 'America/New_York');
echo timezone_select('custom-select', 'America/New_York');

Many functions previously found in the CodeIgniter 3 ``date_helper`` have been moved to the ``I18n``
module in CodeIgniter 4.
Loading

0 comments on commit e0b89a7

Please sign in to comment.