get_file_listing

Description

Gets a list of all files and directories within the directory. Used by SMF to list all files/folders in a theme directory and let the admin edit them if applicable.

Syntax

array get_file_listing (string $path, string $relative)



Parameter $path

Expected type: String
Description: The full path to the directory



Parameter $relative

Expected type: String
Description: Relative path to the directory (from the current directory; not used at the moment)



Return value

Expected type: Array
Description: An array of arrays with information about the files and directories in the specified directory. Each array contains the following keys

Array Elements
Key Optional Expected type Description
filename no String The name of the file or directory
href no String The URL to this entry
is_directory no Boolean Whether or not this is a directory
is_editable no Boolean Whether or not this is editable (specifically: true if this isn't a directory or image, it's writable and its extension is one of the following: php, pl, css, js, vbs, ml, xslt, txt, xsl, htm, html, shtm, shtml, asp, aspx, cgi or py)
is_image no Boolean Whether or not this is an image (specifically: whether or not this is a bmp, jpg/jpeg, gif or png file)
is_template no Boolean Whether or not this is a template file
is_writable no Boolean Whether or not this file or directory is writable
last_modified no String If this isn't a directory, when the file was last modified
size no String If this isn't a directory, how big the file is in kilobytes (or bytes if it's less than 1kb in size)


Notes

  • Does not check permissions
  • Returns an array of arrays with information about the files and folders in the specified directory
  • relative parameter specifies relative path to directory (from current location), although it isn't actually used at the moment
Advertisement: