[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/minify/lib/ -> Minify.php (summary)

Class Minify

File Size: 608 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Minify:: (9 methods):
  setCache()
  serve()
  combine()
  setDocRoot()
  _errorExit()
  _setupDebug()
  _combineMinify()
  _getCacheId()
  _handleCssImports()


Class: Minify  - X-Ref

Minify - Combines, minifies, and caches JavaScript and CSS files on demand.

See README for usage instructions (for now).

This library was inspired by {@link mailto:[email protected] jscsscomp by Maxim Martynyuk}
and by the article {@link http://www.hunlock.com/blogs/Supercharged_Javascript "Supercharged JavaScript" by Patrick Hunlock}.

Requires PHP 5.1.0.
Tested on PHP 5.1.6.

setCache($cache = '', $fileLocking = true)   X-Ref
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.

param: mixed $cache object with identical interface as Minify_Cache_File or
param: bool $fileLocking (default = true) This only applies if the first
return: null

serve($controller, $options = array()   X-Ref
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 @import 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.
param: mixed $controller instance of subclass of Minify_Controller_Base or string
param: array $options controller/serve options
return: null|array if the 'quiet' option is set to true, an array

combine($sources, $options = array()   X-Ref
Return combined minified content for a set of sources

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

param: array $sources array of filepaths and/or Minify_Source objects
param: array $options (optional) array of options for serve. By default
return: string

setDocRoot($docRoot = '')   X-Ref
Set $_SERVER['DOCUMENT_ROOT']. On IIS, the value is created from SCRIPT_FILENAME and SCRIPT_NAME.

param: string $docRoot value to use for DOCUMENT_ROOT

_errorExit($header, $url)   X-Ref

param: string $header
param: string $url

_setupDebug($sources)   X-Ref
Set up sources to use Minify_Lines

param: Minify_Source[] $sources Minify_Source instances

_combineMinify()   X-Ref
Combines sources and minifies the result.

return: string

_getCacheId($prefix = 'minify')   X-Ref
Make a unique cache id for for this request.

Any settings that could affect output are taken into consideration

param: string $prefix
return: string

_handleCssImports($css)   X-Ref
Bubble CSS @imports to the top or prepend a warning if an import is detected not at the top.

param: string $css
return: string



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1