Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
Dataface_JavascriptTool Class Reference

A Class that manages, builds, and maintains dependencies of javacripts. More...

Public Member Functions

 ignore ($script)
 isIgnored ($script)
 ignoreCss ($stylesheet)
 __construct ()
 setMinify ($minify)
 getMinify ()
 setUseCache ($cache)
 getUseCache ()
 mergeCSSPaths ()
 getScripts ()
 clearScripts ()
 copyTo (Dataface_JavascriptTool $target)
 addPath ($path, $url)
 removePath ($path)
 getPaths ()
 clearPaths ()
 import ($path)
 whereis ($script)
 which ($script)
 getURL ()
 getContents ()
 getHtml ()
 unimport ($script)
 compile ($clean=false)
 _includeStringCallback ($matches)
 _importCallback ($matches)
 clearCache ()

Static Public Member Functions

static getInstance ($type=null)

Protected Member Functions

 decorateContents ($contents, $script)
 _compile ($scripts, $passthru=false, $onceOnly=true)

Detailed Description

A Class that manages, builds, and maintains dependencies of javacripts.

Definition at line 7 of file JavascriptTool.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Definition at line 114 of file JavascriptTool.php.

Member Function Documentation

_compile (   $scripts,
  $passthru = false,
  $onceOnly = true 
)
protected

Compiles a set of javascripts specified byt the $scripts array. This respects the //!require and //!include directives which includes other javascript files inline.

Parameters
mixed$scriptsEither a string with a path to a script, or an array of paths.
array&$includedAn "out" array to keep track of which scripts have been included. This is an associative array with key value pairs. The key is the relative path to the script within the include paths. The value is the path to the file on the file system.

Definition at line 521 of file JavascriptTool.php.

_importCallback (   $matches)

Definition at line 590 of file JavascriptTool.php.

_includeStringCallback (   $matches)

Definition at line 586 of file JavascriptTool.php.

addPath (   $path,
  $url 
)

Adds a path to the list of include paths (where the tool looks for scripts).

Parameters
string$pathThe Filesystem path to the directory.
string$urlThe corresponding URL to access this path.

Definition at line 200 of file JavascriptTool.php.

clearCache ( )

Definition at line 610 of file JavascriptTool.php.

clearPaths ( )

Definition at line 222 of file JavascriptTool.php.

clearScripts ( )

Definition at line 175 of file JavascriptTool.php.

compile (   $clean = false)

Definition at line 410 of file JavascriptTool.php.

copyTo ( Dataface_JavascriptTool  $target)

Definition at line 181 of file JavascriptTool.php.

decorateContents (   $contents,
  $script 
)
protected

Definition at line 502 of file JavascriptTool.php.

getContents ( )

Returns the contents of the compiled script (loads it from the cached file).

Definition at line 268 of file JavascriptTool.php.

getHtml ( )

Definition at line 273 of file JavascriptTool.php.

static getInstance (   $type = null)
static

Returns a reference to the singleton instance.

Returns
Dataface_JavascriptTool

Definition at line 95 of file JavascriptTool.php.

getMinify ( )

Gets whether to minify the output or not.

Returns
boolean

Definition at line 132 of file JavascriptTool.php.

getPaths ( )

Returns the include paths as an associative array. [filesystem path] => [url]

Definition at line 218 of file JavascriptTool.php.

getScripts ( )

Gets the scripts that are currently set to be compiled in this tool. This doesn't include all subscripts.

Returns
array Associative array of scripts [relative path] => [absolute path]

Definition at line 171 of file JavascriptTool.php.

getURL ( )

Returns the URL to the resulting script. This precompiles the cached script if it isn't already compiled or is dirty.

Returns
string The URL to access the generated script.

Definition at line 260 of file JavascriptTool.php.

getUseCache ( )
Returns
boolean

Definition at line 146 of file JavascriptTool.php.

ignore (   $script)

Definition at line 77 of file JavascriptTool.php.

ignoreCss (   $stylesheet)

Definition at line 86 of file JavascriptTool.php.

import (   $path)

Adds a script to the list of top-level scripts to be compiled in this bundle.

Parameters
string$pathThe relative path to the script.

Definition at line 230 of file JavascriptTool.php.

isIgnored (   $script)

Definition at line 82 of file JavascriptTool.php.

mergeCSSPaths ( )

Merges the paths of the internal CSS tool with the paths of the singleton CSS tool instance.

Returns
void

Definition at line 155 of file JavascriptTool.php.

removePath (   $path)

Removes a path from the list of include paths.

Parameters
string$pathThe file system path to remove.

Definition at line 209 of file JavascriptTool.php.

setMinify (   $minify)

Sets whether to minify the output or not.

Parameters
boolean$minify

Definition at line 123 of file JavascriptTool.php.

setUseCache (   $cache)
Parameters
boolean$cache

Definition at line 139 of file JavascriptTool.php.

unimport (   $script)

Definition at line 288 of file JavascriptTool.php.

whereis (   $script)

Definition at line 235 of file JavascriptTool.php.

which (   $script)

Definition at line 246 of file JavascriptTool.php.


The documentation for this class was generated from the following file: