\StaticSiteMimeProcessor
Utility class for Mime-Type processing.
- Author: Russell Michell <russell@silverstripe.com>
Synopsis
class StaticSiteMimeProcessor
{
- // members
- public $mimeTypes;
- // methods
- public void __construct()
- public static boolean get_mime_for_ss_type()
- public static array ss_type_to_suffix_map()
- public static mixed ext_to_mime_compare()
- public static array get_mimetypes_from_text()
- public static string cleanse()
- public boolean isOfImage()
- public boolean isOfFile()
- public boolean isOfHtml()
- public boolean isOfFileOrImage()
- public boolean isBadMimeType()
- public void setMimes()
- public array getMimes()
Members
public
- $mimeTypes — array
Methods
public
- __construct()
- cleanse() — Simple cleanup utility
- ext_to_mime_compare() — Compares a file-extension with a mime type. Returns true if the passed extension matches the passed mime.
- getMimes()
- get_mime_for_ss_type() — Based on one of three SilverStripe core classes, returns an array of suitable mime-types from SilverStripe config.
- get_mimetypes_from_text() — Post-proces user-inputted mime-types. Allows space, comma or newline delimited mime-types input into a TextareaField
- isBadMimeType() — Ascertain passed $mime is not something we can do anything useful with
- isOfFile() — Takes an array of mime-type strings and simply returns true after the first File-ish mime-type is found
- isOfFileOrImage() — Simple "shortcut" to isOfFile() and isOfImage()
- isOfHtml() — Takes an array of mime-type strings and simply returns true after the first SiteTree-ish mime-type is found
- isOfImage() — Takes an array of mime-type strings and simply returns true after the first Image-ish mime-type is found
- setMimes()
- ss_type_to_suffix_map() — Return a mapping of SS types (File, SiteTree etc) to suitable file-extensions out of the File class.