Moodle  2.2.1
http://www.collinsharper.com
Minify Class Reference

Static Public Member Functions

static setCache ($cache= '', $fileLocking=true)
static serve ($controller, $options=array())
static combine ($sources, $options=array())
static setDocRoot ($unsetPathInfo=false)

Data Fields

const VERSION = '2.1.3'
const TYPE_CSS = 'text/css'
const TYPE_HTML = 'text/html'
const TYPE_JS = 'application/x-javascript'

Static Public Attributes

static $uploaderHoursBehind = 0
static $importWarning = "/* See http://code.google.com/p/minify/wiki/CommonProblems#@imports_can_appear_in_invalid_locations_in_combined_CSS_files */\n"

Static Protected Member Functions

static _setupDebug ($sources)
static _combineMinify ()
static _getCacheId ()
static _handleCssImports ($css)

Static Protected Attributes

static $_controller = null
static $_options = null

Detailed Description

Definition at line 30 of file Minify.php.


Member Function Documentation

static _combineMinify ( ) [static, protected]

Combines sources and minifies the result.

Returns:
string

Definition at line 422 of file Minify.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static _getCacheId ( ) [static, protected]

Make a unique cache id for for this request.

Any settings that could affect output are taken into consideration

Returns:
string

Definition at line 496 of file Minify.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static _handleCssImports ( css) [static, protected]

Bubble CSS to the top or prepend a warning if an is detected not at the top.

Definition at line 511 of file Minify.php.

Here is the caller graph for this function:

static _setupDebug ( sources) [static, protected]

Set up sources to use Minify_Lines

Parameters:
array$sourcesMinify_Source instances
Returns:
null

Definition at line 406 of file Minify.php.

Here is the caller graph for this function:

static combine ( sources,
options = array() 
) [static]

Return combined minified content for a set of sources

No internal caching will be used and the content will not be HTTP encoded.

Parameters:
array$sourcesarray of filepaths and/or Minify_Source objects
array$options(optional) array of options for serve. By default these are already set: quiet = true, encodeMethod = '', lastModifiedTime = 0.
Returns:
string

Definition at line 343 of file Minify.php.

Here is the call graph for this function:

static serve ( controller,
options = array() 
) [static]

Serve a request for a minified file.

Here are the available options and defaults in the base controller:

'isPublic' : send "public" instead of "private" in Cache-Control headers, allowing shared caches to cache the output. (default true)

'quiet' : set to true to have serve() return an array rather than sending any headers/output (default false)

'encodeOutput' : set to false to disable content encoding, and not send the Vary header (default true)

'encodeMethod' : generally you should let this be determined by HTTP_Encoder (leave null), but you can force a particular encoding to be returned, by setting this to 'gzip' or '' (no encoding)

'encodeLevel' : level of encoding compression (0 to 9, default 9)

'contentTypeCharset' : appended to the Content-Type header sent. Set to a falsey value to remove. (default 'utf-8')

'maxAge' : set this to the number of seconds the client should use its cache before revalidating with the server. This sets Cache-Control: max-age and the Expires header. Unlike the old 'setExpires' setting, this setting will NOT prevent conditional GETs. Note this has nothing to do with server-side caching.

'rewriteCssUris' : If true, serve() will automatically set the 'currentDir' minifier option to enable URI rewriting in CSS files (default true)

'bubbleCssImports' : If true, all declarations in combined CSS files will be move to the top. Note this may alter effective CSS values due to a change in order. (default false)

'debug' : set to true to minify all sources with the 'Lines' controller, which eases the debugging of combined files. This also prevents 304 responses.

See also:
Minify_Lines::minify()

'minifiers' : to override Minify's default choice of minifier function for a particular content-type, specify your callback under the key of the content-type: // call customCssMinifier($css) for all CSS minification $options['minifiers'][Minify::TYPE_CSS] = 'customCssMinifier';

// don't minify Javascript at all $options['minifiers'][Minify::TYPE_JS] = '';

'minifierOptions' : to send options to the minifier function, specify your options under the key of the content-type. E.g. To send the CSS minifier an option: // give CSS minifier array('optionName' => 'optionValue') as 2nd argument $options['minifierOptions'][Minify::TYPE_CSS]['optionName'] = 'optionValue';

'contentType' : (optional) this is only needed if your file extension is not js/css/html. The given content-type will be sent regardless of source file extension, so this should not be used in a Groups config with other Javascript/CSS files.

Any controller options are documented in that controller's setupSources() method.

Parameters:
mixedinstance of subclass of Minify_Controller_Base or string name of controller. E.g. 'Files'
array$optionscontroller/serve options
Returns:
mixed null, or, if the 'quiet' option is set to true, an array with keys "success" (bool), "statusCode" (int), "content" (string), and "headers" (array).

Definition at line 160 of file Minify.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static setCache ( cache = '',
fileLocking = true 
) [static]

Specify a cache object (with identical interface as Minify_Cache_File) or a path to use with Minify_Cache_File.

If not called, Minify will not use a cache and, for each 200 response, will need to recombine files, minify and encode the output.

Parameters:
mixed$cacheobject with identical interface as Minify_Cache_File or a directory path, or null to disable caching. (default = '')
bool$fileLocking(default = true) This only applies if the first parameter is a string.
Returns:
null

Definition at line 77 of file Minify.php.

Here is the caller graph for this function:

static setDocRoot ( unsetPathInfo = false) [static]

On IIS, create $_SERVER['DOCUMENT_ROOT']

Parameters:
bool$unsetPathInfo(default false) if true, $_SERVER['PATH_INFO'] will be unset (it is inconsistent with Apache's setting)
Returns:
null

Definition at line 366 of file Minify.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$_controller = null [static, protected]

Definition at line 392 of file Minify.php.

$_options = null [static, protected]

Definition at line 397 of file Minify.php.

string $importWarning = "/* See http://code.google.com/p/minify/wiki/CommonProblems#@imports_can_appear_in_invalid_locations_in_combined_CSS_files */\n" [static]

If this string is not empty AND the serve() option 'bubbleCssImports' is NOT set, then serve() will check CSS files for declarations that appear too late in the combined stylesheet. If found, serve() will prepend the output with this warning.

Definition at line 60 of file Minify.php.

int $uploaderHoursBehind = 0 [static]

How many hours behind are the file modification times of uploaded files?

If you upload files from Windows to a non-Windows server, Windows may report incorrect mtimes for the files. Immediately after modifying and uploading a file, use the touch command to update the mtime on the server. If the mtime jumps ahead by a number of hours, set this variable to that number. If the mtime moves back, this should not be needed.

Definition at line 50 of file Minify.php.

const TYPE_CSS = 'text/css'

Definition at line 33 of file Minify.php.

const TYPE_HTML = 'text/html'

Definition at line 34 of file Minify.php.

const TYPE_JS = 'application/x-javascript'

Definition at line 37 of file Minify.php.

const VERSION = '2.1.3'

Definition at line 32 of file Minify.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations