DRAFT
Simple File List stores data related to a file list in two places; the file list array the file list settings array. The settings array contains information that defines how the file list appears and behaves, while the file list array contains information about each file and folder.
This article should help you understand the array structures and how to access the data within them. You can then create custom functions in your theme’s functions.php file to allow you to expand on the functionality.
File List Settings
Here is an example to get your started. You can access the file list settings by retrieving the correct WordPress option:
function SimpleFileList_GetSettings () {
$myListSettings = get_option('eeSFL_Settings_1'); // 1 = The List ID
// Look at the Array Output
echo '<pre>'; print_r($myListSettings); echo '</pre>';
exit; // Stop
}
add_action('wp_loaded', 'SimpleFileList_GetSettings');
This will return the file list settings array for list ID 1. Each key in the array represents a specific setting, and the value associated with the key defines the behavior or value of that setting.
$myListSettings = array(
"AdminRole" => "5",
"AllowBulkFileDownload" => "NO",
"AllowFolderDownload" => "NO",
"AllowFrontManage" => "YES",
"AllowOverwrite" => "YES",
"AllowUploads" => "USER",
"FileFormats" => "jpg,jpeg,png,tif,pdf,mov,mp4,mp3,zip",
"FileListDir" => "wp-content/uploads/simple-file-list/",
"FileListURL" => "https://mywebsite.com/wp-content/uploads/simple-file-list/",
"FoldersFirst" => "NO",
"GenerateImgThumbs" => "NO",
"GeneratePDFThumbs" => "NO",
"GenerateVideoThumbs" => "NO",
"GetUploaderDesc" => "NO",
"GetUploaderInfo" => "NO",
"LabelDate" => "Date",
"LabelDesc" => "Description",
"LabelName" => "",
"LabelOwner" => "Submitter",
"LabelSize" => "Size",
"LabelThumb" => "Thumb",
"ListTitle" => "Simple File List",
"MaxSize" => "131072",
"Notify" => "NO",
"NotifyBcc" => "",
"NotifyCc" => "",
"NotifyFrom" => "",
"NotifyFromName" => "Simple File List",
"NotifyMessage" => "",
"NotifySubject" => "File Upload Notice",
"NotifyTo" => "",
"PreserveName" => "YES",
"PreserveSpaces" => "NO",
"ShowBreadCrumb" => "YES",
"ShowFileActions" => "YES",
"ShowFileCopyLink" => "YES",
"ShowFileDate" => "YES",
"ShowFileDateAs" => "Changed",
"ShowFileDesc" => "YES",
"ShowFileDownload" => "YES",
"ShowFileExtension" => "YES",
"ShowFileOpen" => "YES",
"ShowFileSize" => "YES",
"ShowFileThumb" => "YES",
"ShowFolderSize" => "YES",
"ShowHeader" => "YES",
"ShowList" => "USER",
"ShowListStyle" => "Tiles",
"ShowListTheme" => "Dark",
"ShowSubmitterInfo" => "YES",
"ShowUploadLimits" => "YES",
"SmoothScroll" => "YES",
"SortBy" => "DateChanged",
"SortOrder" => "Descending",
"UploadConfirm" => "NO",
"UploadLimit" => "1",
"UploadMaxFileSize" => "1",
"UploadPosition" => "Above",
"UseCache" => "HOUR",
"UseCacheCron" => "YES"
);
Here is a detailed explanation of each key-value pair in the array:
AdminRole
: The role that can access the back-end menu.5
signifies an Admin role, while1
signifies a Subcriber role.AllowBulkFileDownload
: A flag to indicate whether multiple items can be downloaded as a ZIP file. The values can be eitherYES
orNO
.AllowFolderDownload
: A flag that enables or disables the download of entire folders as a ZIP file.AllowFrontManage
: Allows front-end users to manage list items if set toYES
.AllowOverwrite
: If set toYES
, allows uploaded files to overwrite existing ones.AllowUploads
: Defines who can upload files. Possible values areADMIN
,USER
,ALL
, orNO
.FileFormats
: A comma-separated list of file extensions that are allowed to be uploaded.FileListDir
: The directory where the file list is located.FileListURL
: The URL to access the file list.FoldersFirst
: If set toYES
, folders are listed before files.GenerateImgThumbs
: If set toYES
, creates thumbnail files for image files.GeneratePDFThumbs
: If set toYES
, creates thumbnail files for PDF files.GenerateVideoThumbs
: If set toYES
, creates thumbnail files for video files.GetUploaderDesc
: If set toYES
, shows the description box on the upload form.GetUploaderInfo
: If set toYES
, shows submitter inputs on the upload form.LabelDate
: The text string used for the date label.LabelDesc
: The text string used for the description label.LabelName
: The text string used for the name label.LabelOwner
: The text string used for the submitter label.LabelSize
: The text string used for the size label.LabelThumb
: The text string used for the thumbnail label.ListTitle
: The title of the list.MaxSize
: The maximum size (in megabytes) of a file that may be uploaded.Notify
: If set toYES
, sends a file upload notification email.NotifyBcc
: Comma-separated list of email addresses to BCC the upload notification to.NotifyCc
: Comma-separated list of email addresses to CC the upload notification to.NotifyFrom
: The email address from which the upload notification is sent.NotifyFromName
: The sender’s name in the upload notification email.NotifyMessage
: The body of the upload notification email.NotifySubject
: The subject line of the upload notification email.NotifyTo
: Comma-separated list of email addresses to send the upload notification to.PreserveName
: If set toYES
, preserves and displays the original file name.PreserveSpaces
: If set toYES
, converts dashes in file names into spaces.ShowBreadCrumb
: If set toYES
, shows the breadcrumb trail above the file list.ShowFileActions
: If set toYES
, shows file actions like Open, Download, etc.ShowFileCopyLink
: If set toYES
, shows the copy file action.ShowFileDate
: If set toYES
, shows the date of the file.ShowFileDateAs
: Determines whether to display the date the file was added or the date it was last changed.ShowFileDesc
: If set toYES
, shows the file’s description.ShowFileDownload
: If set toYES
, shows the download file action.ShowFileExtension
: If set toYES
, shows the file’s extension.ShowFileOpen
: If set toYES
, shows the open file action.ShowFileSize
: If set toYES
, shows the size of the file.ShowFileThumb
: If set toYES
, shows the file’s thumbnail image.ShowFolderSize
: If set toYES
, shows the size of the folder.ShowHeader
: If set toYES
, shows the file list table header.ShowList
: Defines who can see the list. Options areADMIN
,USER
,ALL
, orNO
.ShowListStyle
: Defines the style of the list. Possible value isTABLE
.ShowListTheme
: Defines the color theme of the list. An example value isDark
.ShowSubmitterInfo
: If set toYES
, shows the submitter’s information.ShowUploadLimits
: If set toYES
, shows the upload limits information on the form.SmoothScroll
: If set toYES
, enables the smooth-scroll effect after a page load.SortBy
: Determines the sort criteria for the files. Options areName
,Added
,Changed
,Size
, orRandom
.SortOrder
: Determines the order of sorting. Options areDescending
orAscending
.UploadConfirm
: If set toYES
, shows a results page after the upload. IfNO
, it returns to the list.UploadLimit
: The number of files that can be uploaded at once.UploadMaxFileSize
: The maximum size of a file that may be uploaded.UploadPosition
: Determines where to show the form, eitherAbove
orBelow
the list.UseCache
: Determines when to re-scan the files. Options areEACH
,DAY
,HOUR
,OFF
.UseCacheCron
: If set toYES
, uses the WordPress wp_cron system.
Note – For the boolean options, YES
typically enables the feature or option, while NO
disables it. For other options, the value is either a specific string or a number.
Accessing the Settings Data
To access individual data item, just refer to their keys:
echo $myListSettings['ListTitle']; // Display the List Title
Extension Settings
Extension plugins may add additional settings options.
Search and Pagination Option
File Access Option
Send Files Options
Media Player Options