SproutCMS

This is the code documentation for the SproutCMS project

class FilesBackendDirectory

Backend for the files module which stores files in a local directory

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-16
**/
class NewClassName extends FilesBackendDirectory {
    
    /**
    * Saves file content from an existing file
    **/
    public function putExisting ($filename, $existing) {
        // Method code goes here
    }
    
    /**
    * Create a copy of the file in a temporary directory.
    * Don't forget to File::destroy_local_copy($temp_filename) when you're done!
    **/
    public function createLocalCopy (string $filename) {
        // Method code goes here
    }
    
    /**
    * Remove a local copy of a file
    **/
    public function cleanupLocalCopy (string $temp_filename) {
        // Method code goes here
    }
    
    /**
    * Moves an uploaded file into the repository.
    * Returns TRUE on success, FALSE on failure.
    **/
    public function moveUpload ($src, $filename) {
        // Method code goes here
    }
    
    /**
    * Saves file content from a stream. Basically just fopen/stream_copy_to_stream/fclose
    **/
    public function putStream ($filename, $stream) {
        // Method code goes here
    }
    
    /**
    * Delete a file
    **/
    public function delete ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns all files which match the specified mask.
    * I have a feeling this returns other sizes (e.g. .small) as well - which may not be ideal.
    **/
    public function glob ($mask) {
        // Method code goes here
    }
    
    /**
    * This is the equivalent of the php readfile function
    **/
    public function readfile ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns file content as a string. Basically the same as file_get_contents
    **/
    public function getString ($filename) {
        // Method code goes here
    }
    
    /**
    * Saves file content as a string. Basically the same as file_put_contents
    **/
    public function putString ($filename, $content) {
        // Method code goes here
    }
    
    /**
    * Sets access and modification time of file
    **/
    public function touch ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the size of an image, or false on failure.
    * 
    * Output format is the same as getimagesize, but will be at a minimum:
    *   [0] =&gt; width, [1] =&gt; height, [2] =&gt; type
    **/
    public function imageSize ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the size, in bytes, of the specified file
    **/
    public function size ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the modified time, in unix timestamp format, of the specified file
    **/
    public function mtime ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns TRUE if the file exists, and FALSE if it does not
    **/
    public function exists ($filename) {
        // Method code goes here
    }
    
    /**
    * Returns the relative URL for a dynamically resized image.
    * 
    * Size formatting is as per {@see File::parseSizeString}, e.g. c400x300
    **/
    public function resizeUrl (int $id, string $size) {
        // Method code goes here
    }
    
    /**
    * Returns the absolute URL for a given file id, including domain.
    **/
    public function absUrl (int $id) {
        // Method code goes here
    }
    
    /**
    * Returns the relative URL for a given file.
    * 
    * Use for content areas.
    **/
    public function relUrl (int $id) {
        // Method code goes here
    }
    
}
?>