Javascript

author Stefan Heinemann
copyright CONTREXX CMS - COMVATION AG
package contrexx
subpackage lib_framework
todo Edit PHP DocBlocks!

 Methods

Activate an available js file

activate(string $name, array $options, bool $dependencies) : bool
Static

The options parameter is specific for the chosen library. The library must define callback methods for the options to be used.

access public
static

Parameters

$name

string

$options

array

$dependencies

bool

Returns

bool

Deactivate a previously activated js file

deactivate(string $name) : bool
Static
access public
static

Parameters

$name

string

Returns

bool

Finds all <script>-Tags in the passed HTML content, strips them out and puts them in the internal JAVASCRIPT placeholder store.

findJavascripts(string $content) 
Static

You can then retreive them all-in-one with JS::getCode().

Parameters

$content

string
  • Reference to the HTML content. Note that it WILL be modified in-place.

Return the available libs

getAvailableLibs() : array
Static
access public
static

Returns

array

Return the code for the placeholder

getCode() : string
Static
access public
static

Returns

string

Get an array of libraries which are ready to load in different versions

getConfigurableLibraries() : array
Static

Returns

arraythe libraries which are ready to configure for skin

Return the last error

getLastError() : string
Static
static
access public

Returns

string

Register a custom css file

registerCSS($file) : bool
Static

Add a new, individual CSS file to the list. The filename has to be relative to the document root.

static
access public

Parameters

$file

Returns

bool

Register special code Add special code to the List

registerCode($code) : bool
Static
static
access public

Parameters

$code

Returns

bool

registerFromRegex()

registerFromRegex($matchinfo) 
Static

Parameters

$matchinfo

Register a custom JavaScript file

registerJS(string $file, bool $template) : bool
Static

Loads a new, individual JavaScript file that will be included in the page response. If a file is registered that already exists as an available JavaScript library, then this one will be loaded instead.

Parameters

$file

string

The path of $file must be specified relative to the document root of the website. I.e. modules/foo/bar.js

$template

bool

is a javascript file which has been included from template External files are also suppored by providing a valid HTTP(S) URI as $file.

Returns

boolReturns TRUE if the file will be loaded, otherwiese FALSE.

Set the offset parameter

setOffset(string $offset) 
Static
static
access public
todo Setting the offset path could be done automatically. Implement such an algorithm and remove this method.

Parameters

$offset

string

Internal helper for replacing comments.

_storeComment($re) 
Static

@see JS::grabComments()

Parameters

$re

Grabs all comments in the given HTML and replaces them with a temporary string.

grabComments(string $content) 
Static

Modifies the given HTML in-place.

Parameters

$content

string

Make the code for the CSS files

makeCSSFiles(array $files) : string
Static
static
access private

Parameters

$files

array

Returns

string

Make the code for the Javascript files

makeJSFiles(array $files) : string
Static
static
access private

Parameters

$files

array

Returns

string

Make the code section for

makeSpecialCode(array $code) : string
Static
access private
static

Parameters

$code

array

Returns

string

Restores all grabbed comments (@see JS::grabComments()) and puts them back in the given content.

restoreComments(string $content) 
Static

Modifies the given HTML in-place.

Parameters

$content

string

 Properties

 

$alternatives : array

This was introduced to prevent the user from overriding the jQuery plugins included by the Contrexx javascript framework.

see \registerFromRegex()
 

$active : array
access private
static
 

$available : array

The format is the following: array( scriptname : array ( jsfiles : array of strings containing all needed javascript files cssfiles : array of strings containing all needed css files dependencies : array of strings containing all dependencies in the right order specialcode : special js code to be executed loadcallback: function that will be executed with the options as parameter when chosen to activate that JS library, so the options can be parsed makecallback: function that will be executed when the code is generated ) )

access private
static
 

$comment_dict 
 

$customCSS : array
static
access private
 

$customCode : array
static
access private
 

$customJS : array
static
access private
 

$error : string
access private
static
 

$offset : string

When the JS files are used e.g. in the cadmin section, all paths need a '../' before the path. This variable holds that offset.

see \setOffset($offset)
access private
static
 

$re_name_postfix 
 

$registeredJsFiles : array
access private
static
 

$shadowBoxLanguage : string
access private
static
 

$shadowBoxPlayers : array
access private
static
 

$templateJS : array
static
access private
© Copyright 2014 by Comvation AG
Generated on 2014-07-11T08:39:27+02:00.