Extension:ScriptingTools

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
ScriptingTools

Release status: beta

Implementation Parser function, Extended syntax
Description
Author(s) user:jldupont
Version See SVN
MediaWiki tested on 1.10 but probably works with a earlier versions
Download SVN

Contents

[edit] Purpose

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).

[edit] Features

  • 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'

[edit] Usage

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.

[edit] Notes

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

[edit] DEPENDANCIES

  • 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

[edit] Installation

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
);

[edit] HISTORY

[edit] See Also

This extension is part of the BizzWiki Platform.

Personal tools