Extension:AddScriptCss

Purpose
Inserts (i.e. Javascript) or (i.e. CSS) code at the bottom of the page's head or within the page's body. Securely inserts arbitrary code to the page's head using.

Features

 * Security: local files (URI) only
 * Files must be located in wiki installation home directory/scripts
 * Security:
 * Only pages with restricted editing can access 'addtohead' functionality (i.e. manually protect the page).
 * Use global variable '$bwScriptsDirectory' to customize scripts directory
 * Use global variable '$bwScriptsDirectory' to customize scripts directory

Examples

 * (R1) e.g. 
 * (R2) e.g.


 * R1) Results in  being added to the page's body section provided the said file exists.


 * R2) The CSS file  will be added to the page's HEAD section (provided it exists).

Syntax
Form 1: 

Form 2:

If no 'type' field is present, then the extension assumes 'js'.

If no 'pos' field is present, then the extension assumes 'body'

USAGE NOTES

 * When using 'pos=body', it is recommended to use the extension 'ParserCacheControl' in order to better integrate this extension with the standard MW parser cache.
 * Use the global variable  to set a new directory for the scripts
 * e.g.  will result in   to be used.

Dependency

 * Depends on Extension:StubManager

History
Zdanie
 * Adjusted for new ExtensionClass version (no automatic registering of hooks of ExtensionClass)
 * Adjusted singleton invocation to end of file (PHP limitation)
 * Imported required functionality from ExtensionClass
 * Imported 'addtohead' tag functionality from SecureHTML extension
 * Removed dependency on ExtensionClass
 * Added support for a global setting '$bwScriptsDirectory'
 * Fixed issue when $IP !== $wgScriptPath

1.0.0

 * Moved to PEAR repository

TODO

 * internationalize
 * Support for customization of scripts directory without touching LocalSettings.php