core/model/modx/modfilehandler.class.php

Show: inherited
Table of Contents

Package
modx  

\modDirectory

Package: modx

Representation of a directory

Not to be instantiated directly - you should implement your own derivative class.

Parent(s)
\modFileSystemResource

Properties

Propertypublic\modFileHandler  $fileHandler= ''
inherited

A reference to a modFileHandler instanceInherited from: \modFileSystemResource::$$fileHandler
Propertypublicarray  $options= 'array()'
inherited

An array of file system resource specific optionsInherited from: \modFileSystemResource::$$options
Default valuearray()Details
Type
array
Inherited_from
\modFileSystemResource::$$options  
Propertyprotectedstring  $path= ''
inherited

The absolute path of the file system resourceInherited from: \modFileSystemResource::$$path
Details
Type
string
Inherited_from
\modFileSystemResource::$$path  

Methods

methodpublic__construct( \modFileHandler $fh, string $path, array $options = array() ) : void
inherited

Constructor for modFileSystemResource

Inherited from: \modFileSystemResource::__construct()
Parameters
Name Type Description
$fh \modFileHandler

A reference to the modFileHandler object

$path string

The path to the fs resource

$options array

An array of specific options

methodpublicchgrp( mixed $grp ) : boolean
inherited

Sets the group permission for the fs resource

Inherited from: \modFileSystemResource::chgrp()
Parameters
Name Type Description
$grp mixed
Returns
Type Description
boolean True if successful
methodpublicchmod( \octal $mode ) : boolean
inherited

Chmods the resource to the specified mode.

Inherited from: \modFileSystemResource::chmod()
Parameters
Name Type Description
$mode \octal
Returns
Type Description
boolean True if successful
methodpublicchown( mixed $owner ) : boolean
inherited

Sets the owner for the fs resource

Inherited from: \modFileSystemResource::chown()
Parameters
Name Type Description
$owner mixed
Returns
Type Description
boolean True if successful
methodpubliccreate( string $mode = '' ) : boolean

Actually creates the new directory on the file system.

Parameters
Name Type Description
$mode string

Optional. The permissions of the new directory.

Returns
Type Description
boolean True if successful
methodpublicexists( ) : boolean
inherited

Check to see if the fs resource exists

Inherited from: \modFileSystemResource::exists()
Returns
Type Description
boolean True if exists
methodpublicgetGroup( ) : string
inherited

Gets the permission group for the fs resource

Inherited from: \modFileSystemResource::getGroup()
Returns
Type Description
string The group name of the fs resource
methodpublicgetParentDirectory( boolean $raw = false ) : \modDirectory | string
inherited

Gets the parent containing directory of this fs resource

Inherited from: \modFileSystemResource::getParentDirectory()
Parameters
Name Type Description
$raw boolean

Whether or not to return a modDirectory or string path

Returns
Type Description
\modDirectory | string Returns either a modDirectory object of the parent directory, or the absolute path of the parent, depending on whether or not $raw is set to true.
methodpublicgetPath( ) : string
inherited

Get the path of the fs resource.

Inherited from: \modFileSystemResource::getPath()
Returns
Type Description
string The path of the fs resource
methodpublicisLink( ) : boolean
inherited

Check to see if fs resource is symlink

Inherited from: \modFileSystemResource::isLink()
Returns
Type Description
boolean True if symlink
methodpublicisReadable( ) : boolean
inherited

Check to see if the fs resource is readable

Inherited from: \modFileSystemResource::isReadable()
Returns
Type Description
boolean True if readable
methodpublicisWritable( ) : boolean
inherited

Check to see if the fs resource is writable

Inherited from: \modFileSystemResource::isWritable()
Returns
Type Description
boolean True if writable
methodprotectedparseMode( string $mode = '' ) : boolean

Parses a string mode into octal format

Parameters
Name Type Description
$mode string
Returns
Type Description
boolean
Details
See
\modFileSystemResource::parseMode  
methodpublicremove( array $options = array() ) : boolean

Removes the directory from the file system, recursively removing subdirectories and files.

Parameters
Name Type Description
$options array

Options for removal.

Returns
Type Description
boolean True if successful
methodpublicrename( string $newPath ) : boolean
inherited

Renames the file/folder

Inherited from: \modFileSystemResource::rename()
Parameters
Name Type Description
$newPath string

The new path for the fs resource

Returns
Type Description
boolean True if successful
methodpublicsetGroup( string $grp ) : boolean
inherited

Alias for chgrp

Inherited from: \modFileSystemResource::setGroup()
Parameters
Name Type Description
$grp string
Returns
Type Description
boolean
Details
See
\chgrp  

\modFile

Package: modx

File implementation of modFileSystemResource

Not to be instantiated directly - you should implement your own derivative class.

Parent(s)
\modFileSystemResource

Properties

Propertyprotectedstring  $content= ''''

The content of the resource
Default value''Details
Type
string
Propertypublic\modFileHandler  $fileHandler= ''
inherited

A reference to a modFileHandler instanceInherited from: \modFileSystemResource::$$fileHandler
Propertypublicarray  $options= 'array()'
inherited

An array of file system resource specific optionsInherited from: \modFileSystemResource::$$options
Default valuearray()Details
Type
array
Inherited_from
\modFileSystemResource::$$options  
Propertyprotectedstring  $path= ''
inherited

The absolute path of the file system resourceInherited from: \modFileSystemResource::$$path
Details
Type
string
Inherited_from
\modFileSystemResource::$$path  

Methods

methodpublic__construct( \modFileHandler $fh, string $path, array $options = array() ) : void
inherited

Constructor for modFileSystemResource

Inherited from: \modFileSystemResource::__construct()
Parameters
Name Type Description
$fh \modFileHandler

A reference to the modFileHandler object

$path string

The path to the fs resource

$options array

An array of specific options

methodpublicchgrp( mixed $grp ) : boolean
inherited

Sets the group permission for the fs resource

Inherited from: \modFileSystemResource::chgrp()
Parameters
Name Type Description
$grp mixed
Returns
Type Description
boolean True if successful
methodpublicchmod( \octal $mode ) : boolean
inherited

Chmods the resource to the specified mode.

Inherited from: \modFileSystemResource::chmod()
Parameters
Name Type Description
$mode \octal
Returns
Type Description
boolean True if successful
methodpublicchown( mixed $owner ) : boolean
inherited

Sets the owner for the fs resource

Inherited from: \modFileSystemResource::chown()
Parameters
Name Type Description
$owner mixed
Returns
Type Description
boolean True if successful
methodpubliccreate( string $content = '', string $mode = 'w+' ) : boolean

Actually create the file on the file system

Parameters
Name Type Description
$content string

The content of the file to write

$mode string

The perms to write with the file

Returns
Type Description
boolean True if successful
methodpublicexists( ) : boolean
inherited

Check to see if the fs resource exists

Inherited from: \modFileSystemResource::exists()
Returns
Type Description
boolean True if exists
methodpublicgetBaseName( ) : string

Gets the basename, or only the filename without the path, of the file

Returns
Type Description
string The basename of the file
methodpublicgetContents( ) : string

Get the contents of the file

Returns
Type Description
string The contents of the file
methodpublicgetExtension( ) : string

Gets the file extension of the file

Returns
Type Description
string The file extension of the file
methodpublicgetGroup( ) : string
inherited

Gets the permission group for the fs resource

Inherited from: \modFileSystemResource::getGroup()
Returns
Type Description
string The group name of the fs resource
methodpublicgetLastAccessed( string $timeFormat = '%b %d, %Y %I:%M:%S %p' ) : string

Gets the last accessed time of the file

Parameters
Name Type Description
$timeFormat string

The format, in strftime format, of the time

Returns
Type Description
string The formatted time
methodpublicgetLastModified( string $timeFormat = '%b %d, %Y %I:%M:%S %p' ) : string

Gets the last modified time of the file

Parameters
Name Type Description
$timeFormat string

The format, in strftime format, of the time

Returns
Type Description
string The formatted time
methodpublicgetParentDirectory( boolean $raw = false ) : \modDirectory | string
inherited

Gets the parent containing directory of this fs resource

Inherited from: \modFileSystemResource::getParentDirectory()
Parameters
Name Type Description
$raw boolean

Whether or not to return a modDirectory or string path

Returns
Type Description
\modDirectory | string Returns either a modDirectory object of the parent directory, or the absolute path of the parent, depending on whether or not $raw is set to true.
methodpublicgetPath( ) : string
inherited

Get the path of the fs resource.

Inherited from: \modFileSystemResource::getPath()
Returns
Type Description
string The path of the fs resource
methodpublicgetSize( ) : int

Gets the size of the file

Returns
Type Description
int The size of the file, in bytes
methodpublicisLink( ) : boolean
inherited

Check to see if fs resource is symlink

Inherited from: \modFileSystemResource::isLink()
Returns
Type Description
boolean True if symlink
methodpublicisReadable( ) : boolean
inherited

Check to see if the fs resource is readable

Inherited from: \modFileSystemResource::isReadable()
Returns
Type Description
boolean True if readable
methodpublicisWritable( ) : boolean
inherited

Check to see if the fs resource is writable

Inherited from: \modFileSystemResource::isWritable()
Returns
Type Description
boolean True if writable
methodprotectedparseMode( string $mode = '' ) : boolean

Parses a string mode into octal format

Parameters
Name Type Description
$mode string
Returns
Type Description
boolean
Details
See
\modFileSystemResource.parseMode  
methodpublicremove( ) : boolean

Deletes the file from the filesystem

Returns
Type Description
boolean True if successful
methodpublicrename( string $newPath ) : boolean
inherited

Renames the file/folder

Inherited from: \modFileSystemResource::rename()
Parameters
Name Type Description
$newPath string

The new path for the fs resource

Returns
Type Description
boolean True if successful
methodpublicsave( string $content = null, string $mode = 'w+' ) : boolean

Writes the content of the modFile object to the actual file.

Parameters
Name Type Description
$content string

Optional. If not using setContent, this will set the content to write.

$mode string

The mode in which to write

Returns
Type Description
boolean The result of the fwrite
methodpublicsetContent( string $content ) : void

Temporarly set (but not save) the content of the file

Parameters
Name Type Description
$content string

The content

methodpublicsetGroup( string $grp ) : boolean
inherited

Alias for chgrp

Inherited from: \modFileSystemResource::setGroup()
Parameters
Name Type Description
$grp string
Returns
Type Description
boolean
Details
See
\chgrp  
methodpublicwrite( string $content = null, string $mode = 'w+' ) : boolean

Alias for save()

Parameters
Name Type Description
$content string
$mode string
Returns
Type Description
boolean
Details
See
\modDirectory::write  

\modFileHandler

Package: modx

Assists with directory/file manipulation

Properties

Propertypublicarray  $config= 'array()'

An array of configuration properties for the class

Default valuearray()Details
Type
array
Propertypublic\modContext|null  $context= 'null'

The current context in which this File Manager instance should operate

Default valuenullDetails
Type
\modContext | null

Methods

methodpublic__construct( \modX $modx, array $config = array() ) : void

The constructor for the modFileHandler class

Parameters
Name Type Description
$modx \modX

&$modx A reference to the modX object.

$config array

An array of options.

methodpublicgetBasePath( ) : string

Get the modX base path for the user.

Returns
Type Description
string The base path
methodpublicgetBaseUrl( ) : string

Get base URL of file manager

Returns
Type Description
string The base URL
methodpublicgetDirectoryFromFile( string $fileName ) : string

Gets the directory path for a given file

Parameters
Name Type Description
$fileName string

The path for a file

Returns
Type Description
string The directory path of the given file
methodpublicisBinary( string $file ) : boolean

Tells if a file is a binary file or not.

Parameters
Name Type Description
$file string
Returns
Type Description
boolean True if a binary file.
methodpublicmake( string $path, array $options = array(), string $overrideClass = '' ) : mixed

Dynamically creates a modDirectory or modFile object.

The object is created based on the type of resource provided.

Parameters
Name Type Description
$path string

The absolute path to the filesystem resource.

$options array

Optional. An array of options for the object.

$overrideClass string

Optional. If provided, will force creation of the object as the specified class.

Returns
Type Description
mixed The appropriate modFile/modDirectory object
methodpublicpostfixSlash( string $path ) : string

Ensures that the passed path has a / at the end

Parameters
Name Type Description
$path string
Returns
Type Description
string The postfixed path
methodpublicsanitizePath( string $path ) : string

Sanitize the specified path

Parameters
Name Type Description
$path string

The path to clean

Returns
Type Description
string The sanitized path

\modFileSystemResource

Package: modx

Abstract class for handling file system resources (files or folders).

Not to be instantiated directly - you should implement your own derivative class.

Children
\modFile
\modDirectory

Properties

Propertypublic\modFileHandler  $fileHandler= ''

A reference to a modFileHandler instance
Details
Type
\modFileHandler
Propertypublicarray  $options= 'array()'

An array of file system resource specific options
Default valuearray()Details
Type
array
Propertyprotectedstring  $path= ''

The absolute path of the file system resource
Details
Type
string

Methods

methodpublic__construct( \modFileHandler $fh, string $path, array $options = array() ) : void

Constructor for modFileSystemResource

Parameters
Name Type Description
$fh \modFileHandler

A reference to the modFileHandler object

$path string

The path to the fs resource

$options array

An array of specific options

methodpublicchgrp( mixed $grp ) : boolean

Sets the group permission for the fs resource

Parameters
Name Type Description
$grp mixed
Returns
Type Description
boolean True if successful
methodpublicchmod( \octal $mode ) : boolean

Chmods the resource to the specified mode.

Parameters
Name Type Description
$mode \octal
Returns
Type Description
boolean True if successful
methodpublicchown( mixed $owner ) : boolean

Sets the owner for the fs resource

Parameters
Name Type Description
$owner mixed
Returns
Type Description
boolean True if successful
methodpublicexists( ) : boolean

Check to see if the fs resource exists

Returns
Type Description
boolean True if exists
methodpublicgetGroup( ) : string

Gets the permission group for the fs resource

Returns
Type Description
string The group name of the fs resource
methodpublicgetParentDirectory( boolean $raw = false ) : \modDirectory | string

Gets the parent containing directory of this fs resource

Parameters
Name Type Description
$raw boolean

Whether or not to return a modDirectory or string path

Returns
Type Description
\modDirectory | string Returns either a modDirectory object of the parent directory, or the absolute path of the parent, depending on whether or not $raw is set to true.
methodpublicgetPath( ) : string

Get the path of the fs resource.

Returns
Type Description
string The path of the fs resource
methodpublicisLink( ) : boolean

Check to see if fs resource is symlink

Returns
Type Description
boolean True if symlink
methodpublicisReadable( ) : boolean

Check to see if the fs resource is readable

Returns
Type Description
boolean True if readable
methodpublicisWritable( ) : boolean

Check to see if the fs resource is writable

Returns
Type Description
boolean True if writable
methodprotectedparseMode( string $mode = '' ) : \octal

Parses a string mode into octal format

Parameters
Name Type Description
$mode string

The octal to parse

Returns
Type Description
\octal The new mode in octal format
methodpublicrename( string $newPath ) : boolean

Renames the file/folder

Parameters
Name Type Description
$newPath string

The new path for the fs resource

Returns
Type Description
boolean True if successful
methodpublicsetGroup( string $grp ) : boolean

Alias for chgrp

Parameters
Name Type Description
$grp string
Returns
Type Description
boolean
Details
See
\chgrp  
Documentation was generated by DocBlox 0.18.1.