Accessing Simple File List Data

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, while 1 signifies a Subcriber role.
  • AllowBulkFileDownload: A flag to indicate whether multiple items can be downloaded as a ZIP file. The values can be either YES or NO.
  • 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 to YES.
  • AllowOverwrite: If set to YES, allows uploaded files to overwrite existing ones.
  • AllowUploads: Defines who can upload files. Possible values are ADMIN, USER, ALL, or NO.
  • 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 to YES, folders are listed before files.
  • GenerateImgThumbs: If set to YES, creates thumbnail files for image files.
  • GeneratePDFThumbs: If set to YES, creates thumbnail files for PDF files.
  • GenerateVideoThumbs: If set to YES, creates thumbnail files for video files.
  • GetUploaderDesc: If set to YES, shows the description box on the upload form.
  • GetUploaderInfo: If set to YES, 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 to YES, 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 to YES, preserves and displays the original file name.
  • PreserveSpaces: If set to YES, converts dashes in file names into spaces.
  • ShowBreadCrumb: If set to YES, shows the breadcrumb trail above the file list.
  • ShowFileActions: If set to YES, shows file actions like Open, Download, etc.
  • ShowFileCopyLink: If set to YES, shows the copy file action.
  • ShowFileDate: If set to YES, 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 to YES, shows the file’s description.
  • ShowFileDownload: If set to YES, shows the download file action.
  • ShowFileExtension: If set to YES, shows the file’s extension.
  • ShowFileOpen: If set to YES, shows the open file action.
  • ShowFileSize: If set to YES, shows the size of the file.
  • ShowFileThumb: If set to YES, shows the file’s thumbnail image.
  • ShowFolderSize: If set to YES, shows the size of the folder.
  • ShowHeader: If set to YES, shows the file list table header.
  • ShowList: Defines who can see the list. Options are ADMIN, USER, ALL, or NO.
  • ShowListStyle: Defines the style of the list. Possible value is TABLE.
  • ShowListTheme: Defines the color theme of the list. An example value is Dark.
  • ShowSubmitterInfo: If set to YES, shows the submitter’s information.
  • ShowUploadLimits: If set to YES, shows the upload limits information on the form.
  • SmoothScroll: If set to YES, enables the smooth-scroll effect after a page load.
  • SortBy: Determines the sort criteria for the files. Options are Name, Added, Changed, Size, or Random.
  • SortOrder: Determines the order of sorting. Options are Descending or Ascending.
  • UploadConfirm: If set to YES, shows a results page after the upload. If NO, 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, either Above or Below the list.
  • UseCache: Determines when to re-scan the files. Options are EACH, DAY, HOUR, OFF.
  • UseCacheCron: If set to YES, 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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.