WOOF_File Pro

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

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

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