WOOF_File

Extends WOOF_Wrap

Methods

A powerful class representing a file within your WordPress site, which also provides base methods for the WOOF_Image class.

List of Methods

Property Methods

Manipulation

  • delete()Boolean

    Deletes the file from the file-system, assuming the web user has enough permission to do so.

Theming

  • enclosure( Arguments $attr = array )String

    Generates an RSS enclosure tag representing  the file.

Files

  • contents()

    Reads the content of the file and returns the string representation of that content.

Utility

  • __construct( String $path, String $url )String

    The constructor for WOOF_File, to create the object, which requires both the path to the file and its URL.

  • file_type_categories()Array

    A utility method to retrieve a grouped list of file types grouped by the “category” of the file.

  • render( Array $data, Boolean $strip_whitespace = false )String

    Returns a string representing the file rendered as a Mustache template for the given data. .

  • to_bytes( String $str )Integer

    Converts sizes of the form “128M”, “2G”, “1K” to the equivalent integer byte size.

Internal Use

  • __construct( String $path, String $url )String

    The constructor for WOOF_File, to create the object, which requires both the path to the file and its URL.

  • infer_content_path( String $url )String

    Attempts to infer the path of the given URL in the WordPress content directory. Note: this function is intended for internal use.

  • __construct( String $path, String $url )String

    The constructor for WOOF_File, to create the object, which requires both the path to the file and its URL.

  • abs()

    An alias for the WOOF_File::permalink method, to retrieve the absolute URL to this file.

  • absolute_url()String

    An alias for the WOOF_File::permalink method, to retrieve the absolute URL to this file.

  • basename()String

    Returns the name of the file, including extension.

  • bytes()Integer

    A more concise synonym for the WOOF_File::filesizeinbytes method, to retrieve the integer size of the file in bytes.

  • changed( String $format = null )String OR Integer

    Returns the inode change time of a file as a date value or formatted date string, which is accessed via PHP’s filectime function.

  • contents()

    Reads the content of the file and returns the string representation of that content.

  • delete()Boolean

    Deletes the file from the file-system, assuming the web user has enough permission to do so.

  • enclosure( Arguments $attr = array )String

    Generates an RSS enclosure tag representing  the file.

  • exists()Boolean

    Checks if this file object does indeed point to a valid file path.

  • extension( Boolean $with_period = false )String

    Returns the extension of the file with or without the period.

  • file_type_categories()Array

    A utility method to retrieve a grouped list of file types grouped by the “category” of the file.

  • filename()String

    Retrieves the name of the file, sans-extension.

  • filepath()String

    Retrieves the full path to the file name in the file system.

  • filesize( String $unit = "AUTO", Boolean $with_unit = true, String $sep =  , Integer $base = 1024 )String

    Retrieves the formatted size of the file on disk.

  • filesizeinbytes()Integer

    Retrieves the integer size of the file in bytes.

  • filetype()String

    Returns a descriptive string of the type of the file.

  • format_filesize( Integer $size, String $unit = "AUTO", Boolean $with_unit = true, String $sep =  , Integer $base = 1024 )String

    A general purpose method to format an integer containing a file size in bytes into a formatted file size string. .

  • infer_content_path( String $url )String

    Attempts to infer the path of the given URL in the WordPress content directory. Note: this function is intended for internal use.

  • info()Array

    Retrieves an associative array of info about this file.

  • mime()String

    Retrieves the MIME type string for the file.

  • modified( String $format = null )String OR Integer

    Returns the last modified time of a file as a date value or formatted date string, which is accessed via PHP’s filemtime function.

  • name()String

    A more concise synonym for the WOOF_File::basename method, to retrieve the name of the file, including extension.

  • path()String

    A synonym of the WOOF_File::filepath method, to retrieve the full path to the file name in the file system.

  • render( Array $data, Boolean $strip_whitespace = false )String

    Returns a string representing the file rendered as a Mustache template for the given data. .

  • short_filetype()String

    Returns a shortened descriptive string of the type of the file.

  • size( String $unit = "AUTO", Boolean $with_unit = true, String $sep =  , Integer $base = 1024 )String

    An alias for the WOOF_File::filesize method to retrieve the formatted size of the file on disk.

  • to_bytes( String $str )Integer

    Converts sizes of the form “128M”, “2G”, “1K” to the equivalent integer byte size.

  • url( Boolean $root_relative = true )String

    Retrieves the URL to the file, which can be a full URL, or root_relative (excluding the protocol and domain).

Base Class Methods

View method list from the base class WOOF_Wrap.

Latest From the Blog

MasterPress 1.1.4 now available

MasterPress 1.1.4 is now available. This release contains an important compatibility fix for WordPress 4.5 to allow correct detection of the taxonomy term editing screen. Without this fix, any custom fields you have attached to custom taxonomies will not be shown at all in the editing form. Note also that MasterPress will still detect the edit screen correctly in… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 3.4, MySQL 5, and PHP version 5.2.4.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the WordPress.com hosted service.

Three AM Web + IT