Extension:FormProc

From MediaWiki.org

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

Release status: stable

Implementation User interface, Tag
Description
Author(s) Jean-Lou Dupont (jldupont Talk)
Version See SVN ($Id: FormProc.php 539 2007-08-01 14:23:45Z jeanlou.dupont $)
MediaWiki tested on 1.10 but probably works with earlier versions
Download SVN
Hooks used

UnknownAction

Contents

[edit] Purpose

This extension offers the ability to process posted pages/forms through the 'action=formsubmit' action. The processing code resides in the database. The code can be 'syntax highlighted' through a <php> tag.

[edit] Features

  • Handles 'action=formsubmit' action
  • Follows 'redirects'
  • Executes PHP code stored in a standard Mediawiki page
  • Supports code extraction when enclosed in 'PHP' tags
  • Supports the definition of a class in the processor page ( $page.'Class' )
    • If a method 'submit' is present in the said class, it will be called upon formsubmit action (see example)

[edit] Example

[edit] Form Processing Page 'MyFormProc'

 <!-- remove pre section -->
<php>
  class MyFormProcClass
  {
         function submit() { implement your handler here }
  }
</php>

So in the above case, your form should POST to something like MyFormProc?action=formsubmit.

[edit] Dependencies

[edit] Installation

To install independently from BizzWiki:

  • Download 'StubManager' extension
  • Apply the following changes to 'LocalSettings.php'
require('extensions/StubManager.php');
require('extensions/RunPHP_class.php');
StubManager::createStub(  'FormProcClass',  // recent versions: try 'FormProc'
                                $IP.'/extensions/FormProc/FormProc.php',  // recent versions: try FormProc.body.php
                                null,
                                array( 'UnknownAction' ),
                                false, // no need for logging support
                                null,  // tags
                                null,  // no parser functions
                                null   // no magic words
                         );

[edit] History

  • added functionality to define a class for handling form processing
  • removed dependency on ExtensionClass
  • added stubbing capability through StubManager

[edit] See also

Personal tools