Extension:ScriptingTools

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
ScriptingTools

Release status: beta

Implementation Parser function, Extended syntax
Author(s) user:jldupont
Latest version See SVN
MediaWiki tested on 1.10 but probably works with a earlier versions
License No license specified
Download SVN

Translate the ScriptingTools extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Purpose[edit | edit source]

Provides an interface to page scripting (i.e. Javascript). The extension provides 'minify and store' functionality for Javascript scripts. Furthermore, a special parser function '#epropset' is provided as bridge between an HTML based page and JS scripts associated with the page (e.g. Mootools based widgets).

Features[edit | edit source]

  • The page can contain normal wikitext without disturbing the intended functionality of this extension
  • '__jsminandstore__' magic word to enable 'Minify & Store' operation
  • Appends '.js' to the file if the source page doesn't end with the '.js' extension
  • Secure: only 'edit' protected pages are allowed
  • Respects BizzWiki's global setting for scripts directory '$bwScriptsDirectory'
  • Supports only one Javascript code section per page
  • Integrates with 'geshi' extensions highlighting the 'js' or 'javascript' tagged section
  • Parser Function '#epropset'

Usage[edit | edit source]

1) For the 'minify and store' functionality, just edit the desired page and put the JS code within 'js' tagged section and place the magic word '__jsminandstore__' inside a comment section within the code OR just in the wikitext page itself. 2) For the 'scripting bridge', more details to come.

Notes[edit | edit source]

  • Make sure that the scripts directory is writable by the PHP process

DEPENDENCIES[edit | edit source]

  • Extension:StubManager extension
  • For the 'scripting bridge' functionality, the following constitute dependencies:
    • Extension:PageFunctions extension
    • Extension:ParserPhase2 extension
      • Relies on the hook 'EndParserPhase2' to feed the script snippets collected through this extension
      • ParserPhase2 extension is *not* required for the 'Minify and Store' functionality

Installation[edit | edit source]

To install outside the BizzWiki platform:

  • Download Extension:StubManager
    • Place 'StubManager.php' file in '/extensions' directory
  • Download Extension:PageFunctions extension (if required)
    • Place 'PageFunctions.php' in '/extensions/PageFunctions' directory
    • Follow the instructions from the extension's description page Extension:PageFunctions
  • Download the extension files from the SVN repository
    • Place the files in '/extensions/ScriptingTools' directory
  • Perform the following changes to 'LocalSettings.php':
require('/extensions/StubManager.php');
 
StubManager::createStub( 'ScriptingToolsClass', 
 '/extensions/ScriptingTools/ScriptingTools.php',
 null,					// i18n file			
 array('ArticleSave', 'ParserAfterTidy' ),	// hooks
 false, 					// no need for logging support
 null,					// tags
 null,					// parser Functions
 null
);

HISTORY[edit | edit source]

See Also[edit | edit source]

This extension is part of the BizzWiki Platform.