Class TinyMCE_Compressor
This class combines and compresses the TinyMCE core, plugins, themes and
language packs into one disk cached gzipped request. It improves the loading
speed of TinyMCE dramatically but still provides dynamic initialization.
Example of direct usage: require_once("../js/tinymce/tinymce.gzip.php");
// Renders script tag with compressed scripts
TinyMCE_Compressor::renderTag(array( "url" =>
"../js/tinymce/tinymce.gzip.php", "plugins" => "pagebreak,style", "themes"
=> "advanced", "languages" => "en" ));
Methods summary
public
|
#
__construct( Array $settings = array() )
Constructs a new compressor instance.
Constructs a new compressor instance.
Parameters
- $settings
Array $settings Name/value array with non-default settings for the compressor
instance.
|
public
&
|
#
addFile( String $file )
Adds a file to the concatenation/compression process.
Adds a file to the concatenation/compression process.
Parameters
- $file
String $path Path to the file to include in the compressed package/output.
|
public
|
#
handleRequest( )
Handles the incoming HTTP request and sends back a compressed script
depending on settings and client support.
Handles the incoming HTTP request and sends back a compressed script
depending on settings and client support.
|
public static
String
|
#
renderTag( Array $tagSettings, Bool $return = false )
Renders a script tag that loads the TinyMCE script.
Renders a script tag that loads the TinyMCE script.
Parameters
- $tagSettings
Array $settings Name/value array with settings for the script tag.
- $return
Bool $return The script tag is return instead of being output if true
Returns
String the tag is returned if $return is true
|
public static
String
|
#
getParam( String $name, String $default = "" )
Returns a sanitized query string parameter.
Returns a sanitized query string parameter.
Parameters
- $name
String $name Name of the query string param to get.
- $default
String $default Default value if the query string item shouldn't exist.
Returns
String Sanitized query string parameter value.
|
private
Int
|
#
parseTime( String $time )
Parses the specified time format into seconds. Supports formats like 10h,
10d, 10m.
Parses the specified time format into seconds. Supports formats like 10h,
10d, 10m.
Parameters
- $time
String $time Time format to convert into seconds.
Returns
Int Number of seconds for the specified format.
|
private
String
|
#
getFileContents( String $file )
Returns the contents of the script file if it exists and removes the UTF-8
BOM header if it exists.
Returns the contents of the script file if it exists and removes the UTF-8
BOM header if it exists.
Parameters
- $file
String $file File to load.
Returns
String File contents or empty string if it doesn't exist.
|
Properties summary
private
mixed
|
$files
|
|
|
private
mixed
|
$settings
|
|
|
private static
array
|
$defaultSettings
|
array(
"plugins" => "",
"themes" => "",
"languages" => "",
"disk_cache" => false,
"expires" => "30d",
"cache_dir" => "",
"compress" => true,
"files" => "",
"source" => true,
) |
|