Skip to content

Commit

Permalink
Merge pull request #8224 from kenjis/docs-filesystem_helper-decoration
Browse files Browse the repository at this point in the history
docs: improve  filesystem_helper
  • Loading branch information
kenjis authored Nov 21, 2023
2 parents 45ce53b + fd07f4f commit c844adb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions user_guide_src/source/helpers/filesystem_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Filesystem Helper
#################

The Directory Helper file contains functions that assist in working with
directories.
The Filesystem Helper file contains functions that assist in working with
files and directories.

.. contents::
:local:
Expand All @@ -24,7 +24,7 @@ The following functions are available:
.. php:function:: directory_map($sourceDir[, $directoryDepth = 0[, $hidden = false]])
:param string $sourceDir: Path to the source directory
:param int $directoryDepth: Depth of directories to traverse (0 = fully recursive, 1 = current dir, etc)
:param int $directoryDepth: Depth of directories to traverse (``0`` = fully recursive, ``1`` = current dir, etc)
:param bool $hidden: Whether to include hidden paths
:returns: An array of files
:rtype: array
Expand All @@ -33,17 +33,17 @@ The following functions are available:

.. literalinclude:: filesystem_helper/002.php

.. note:: Paths are almost always relative to your main index.php file.
.. note:: Paths are almost always relative to your main **index.php** file.

Sub-folders contained within the directory will be mapped as well. If
you wish to control the recursion depth, you can do so using the second
parameter (integer). A depth of 1 will only map the top level directory:
parameter (integer). A depth of ``1`` will only map the top level directory:

.. literalinclude:: filesystem_helper/003.php

By default, hidden files will not be included in the returned array and
hidden directories will be skipped. To override this behavior, you may
set a third parameter to true (boolean):
set a third parameter to ``true`` (boolean):

.. literalinclude:: filesystem_helper/004.php

Expand Down Expand Up @@ -99,7 +99,7 @@ The following functions are available:
:param string $path: File path
:param string $data: Data to write to file
:param string $mode: ``fopen()`` mode
:returns: true if the write was successful, false in case of an error
:returns: ``true`` if the write was successful, ``false`` in case of an error
:rtype: bool

Writes data to the file specified in the path. If the file does not exist then the
Expand All @@ -113,14 +113,14 @@ The following functions are available:

.. literalinclude:: filesystem_helper/007.php

The default mode is 'wb'. Please see the `PHP user guide <https://www.php.net/manual/en/function.fopen.php>`_
The default mode is ``'wb'``. Please see `fopen() <https://www.php.net/manual/en/function.fopen.php>`_ in the PHP manual
for mode options.

.. note:: In order for this function to write data to a file, its permissions must
be set such that it is writable. If the file does not already exist,
then the directory containing it must be writable.

.. note:: The path is relative to your main site index.php file, NOT your
.. note:: The path is relative to your main site **index.php** file, NOT your
controller or view files. CodeIgniter uses a front controller so paths
are always relative to the main site index.

Expand All @@ -132,7 +132,7 @@ The following functions are available:
:param bool $delDir: Whether to also delete directories
:param bool $htdocs: Whether to skip deleting .htaccess and index page files
:param bool $hidden: Whether to also delete hidden files (files beginning with a period)
:returns: true on success, false in case of an error
:returns: ``true`` on success, ``false`` in case of an error
:rtype: bool

Deletes ALL files contained in the supplied path.
Expand All @@ -141,7 +141,7 @@ The following functions are available:

.. literalinclude:: filesystem_helper/008.php

If the second parameter is set to true, any directories contained within the supplied
If the second parameter is set to ``true``, any directories contained within the supplied
root path will be deleted as well.

Example:
Expand Down Expand Up @@ -204,7 +204,7 @@ The following functions are available:
:returns: Symbolic permissions string
:rtype: string

Takes numeric permissions (such as is returned by ``fileperms()``) and returns
Takes numeric permissions (such as is returned by `fileperms() <https://www.php.net/manual/en/function.fileperms.php>`_) and returns
standard symbolic notation of file permissions.

.. literalinclude:: filesystem_helper/012.php
Expand All @@ -215,7 +215,7 @@ The following functions are available:
:returns: Octal permissions string
:rtype: string

Takes numeric permissions (such as is returned by ``fileperms()``) and returns
Takes numeric permissions (such as is returned by `fileperms() <https://www.php.net/manual/en/function.fileperms.php>`_) and returns
a three character octal notation of file permissions.

.. literalinclude:: filesystem_helper/013.php
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/helpers/filesystem_helper/004.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

$map = directory_map('./mydirectory/', false, true);
$map = directory_map('./mydirectory/', 0, true);

0 comments on commit c844adb

Please sign in to comment.