Properties

$trigger

$trigger : 

Type

$hook

$hook : 

Type

Methods

mkdir()

mkdir(string  $path) : boolean

Custom make directory function.

This function will check if the path is an existing directory, if not, then it will be created with set permissions and also created recursively if needed.

Parameters

string $path

Path to be created.

Throws

\TriTan\Exception\IOException

If session.savepath is not set, path is not writable, or lacks permission to mkdir.

Returns

boolean

rmdir()

rmdir(string  $dir) 

Removes directory recursively along with any files.

Parameters

string $dir

Directory that should be removed.

getContents()

getContents(string  $filename, boolean  $use_include_path = false, boolean  $context = true) 

Custom function to use curl, fopen, or use file_get_contents if curl is not available.

Uses trigger_include_path_search, resource_context and stream_context_create_options filters.

Parameters

string $filename

Resource to read.

boolean $use_include_path

Whether or not to use include path.

boolean $context

Whether or not to use a context resource.

subdomainAsDirectory()

subdomainAsDirectory() : string

Subdomain as directory function uses the subdomain of the install as a directory.

Returns

string

getFunctions()

getFunctions(string  $filename, boolean  $sort = false) 

Returns an array of function names in a file.

Parameters

string $filename

The path to the file.

boolean $sort

If true, sort results by function name.

isDuplicateFunction()

isDuplicateFunction(string  $filename) 

Checks a given file for any duplicated named user functions.

Parameters

string $filename

checkIncludes()

checkIncludes(string  $filename) 

Performs a check within a php script and returns any other files that might have been required or included.

Parameters

string $filename

PHP script to check.

checkSyntax()

checkSyntax(string  $filename, boolean  $check_includes = true) : void|\TriTan\Exception\Exception

Performs a syntax and error check of a given PHP script.

Parameters

string $filename

PHP script/file to check.

boolean $check_includes

If set to true, will check if other files have been included.

Throws

\TriTan\Exception\NotFoundException

If file does not exist or is not readable.

\TriTan\Exception\Exception

If file contains duplicate function names.

Returns

void|\TriTan\Exception\Exception

winIsWritable()

winIsWritable(string  $path) : boolean

Single file writable atribute check.

Thanks to legolas558.users.sf.net

Parameters

string $path

Returns

boolean

isWritable()

isWritable(string  $path) 

Alternative to PHP's native is_writable function due to a Window's bug.

Parameters

string $path

Path to check.

exists()

exists(string  $filename, boolean  $throw = true) : boolean

Checks whether a file or directory exists.

Parameters

string $filename

Path to the file or directory.

boolean $throw

Determines whether to do a simple check or throw an exception. Default: true.

Throws

\TriTan\Exception\NotFoundException

If file does not exist.

Returns

boolean —

true if the file or directory specified by $filename exists; false otherwise.

directoryListing()

directoryListing(string  $dir, string  $bool = "dirs") 

Get an array that represents directory tree.

Parameters

string $dir

Directory path

string $bool

Include sub directories

beautifyFilename()

beautifyFilename(string  $filename) : string

Beautifies a filename for use.

Uses beautified_filename filter hook.

Parameters

string $filename

Filename to beautify.

Returns

string —

Beautified filename.

sanitizeFilename()

sanitizeFilename(string  $filename, boolean  $beautify = true) : string

Sanitizes a filename.

Uses sanitized_filename filter hook.

Parameters

string $filename

Name of file to sanitize.

boolean $beautify

Whether or not to beautify the sanitized filename.

Returns

string —

Sanitized filename for use.

normalizePath()

normalizePath(string  $path) : string

Normalize a filesystem path.

Parameters

string $path

Path to normalize.

Returns

string —

Normalized path.

removeTrailingSlash()

removeTrailingSlash(string  $string) : string

Removes trailing forward slashes and backslashes if they exist.

The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.

Parameters

string $string

What to remove the trailing slashes from.

Returns

string —

String without the trailing slashes.

addTrailingSlash()

addTrailingSlash(string  $string) : string

Appends a trailing slash.

Will remove trailing forward and backslashes if it exists already before adding a trailing forward slash. This prevents double slashing a string or path.

The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.

Parameters

string $string

What to add the trailing slash to.

Returns

string —

String with trailing slash added.