Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
PFAutoeditAPI Class Reference
Inheritance diagram for PFAutoeditAPI:
Inheritance graph
[legend]
Collaboration diagram for PFAutoeditAPI:
Collaboration graph
[legend]

Public Member Functions

 addOptionsFromString ( $options)
 
 getOptions ()
 
 getAction ()
 
 setOptions ( $options)
 
 setOption ( $option, $value)
 
 getStatus ()
 
 execute ()
 
 prepareAction ()
 
 getTextForPage ( $title)
 
 doAction ()
 
 isWriteMode ()
 
 getAllowedParams ()
 
 getParamDescription ()
 
 getDescription ()
 
 getVersion ()
 

Static Public Member Functions

static makeRandomNumber ( $numDigits=1, $hasPadding=false)
 
static addToArray (&$array, $key, $value, $toplevel=true)
 

Public Attributes

const ACTION_FORMEDIT = 0
 
const ACTION_SAVE = 1
 
const ACTION_PREVIEW = 2
 
const ACTION_DIFF = 3
 
const ERROR = 0
 
const WARNING = 1
 
const NOTICE = 2
 
const DEBUG = 3
 

Protected Member Functions

 getFormTitle ()
 
 setupEditPage ( $targetContent)
 
 setResultFromOutput ()
 
 doPreview ( $editor)
 
 doDiff ( $editor)
 
 doStore (EditPage $editor)
 
 finalizeResults ()
 
 setHeaders ()
 
 generateTargetName ( $targetNameFormula)
 
 getExamples ()
 

Member Function Documentation

◆ addOptionsFromString()

PFAutoeditAPI::addOptionsFromString (   $options)

Converts an options string into an options array and stores it

Parameters
string$options
Returns
the options array

◆ addToArray()

static PFAutoeditAPI::addToArray ( $array,
  $key,
  $value,
  $toplevel = true 
)
static

This function recursively inserts the value into a tree.

Parameters
array&$arrayis root
string$keyidentifies path to position in tree. Format: 1stLevelName[2ndLevel][3rdLevel][...], i.e. normal array notation
mixed$valuethe value to insert
bool$toplevelif this is a toplevel value.

◆ doAction()

PFAutoeditAPI::doAction ( )

Depending on the requested action this method will try to store/preview the data in mOptions or retrieve the edit form.

The form and target page will be available in mOptions after execution of the method.

Errors and warnings are logged in the API result under the 'errors' key. The general request status is maintained in mStatus.

$wgRequest $wgOut PFFormPrinter $wgPageFormsFormPrinter

Exceptions
MWException

◆ execute()

PFAutoeditAPI::execute ( )

Evaluates the parameters, performs the requested API query, and sets up the result.

The execute() method will be invoked when an API call is processed.

The result data is stored in the ApiResult object available through getResult().

◆ generateTargetName()

PFAutoeditAPI::generateTargetName (   $targetNameFormula)
protected

Generates a target name from the given target name formula

This parses the formula and replaces <unique number> tags

Parameters
type$targetNameFormula
Exceptions
MWException
Returns
type

◆ getAction()

PFAutoeditAPI::getAction ( )

Returns the action performed by the module.

Return value is either null or one of ACTION_SAVE, ACTION_PREVIEW, ACTION_FORMEDIT

Returns
null|number

◆ getAllowedParams()

PFAutoeditAPI::getAllowedParams ( )

Returns the array of allowed parameters (parameter name) => (default value) or (parameter name) => (array with PARAM_* constants as keys) Don't call this function directly: use getFinalParams() to allow hooks to modify parameters as needed.

Returns
array or false

◆ getDescription()

PFAutoeditAPI::getDescription ( )

Returns the description string for this module

Returns
string|string[]

◆ getExamples()

PFAutoeditAPI::getExamples ( )
protected

Returns usage examples for this module.

Returns
string|string[]

◆ getFormTitle()

PFAutoeditAPI::getFormTitle ( )
protected

Get the Title object of a form suitable for editing the target page.

Returns
Title
Exceptions
MWException

◆ getOptions()

PFAutoeditAPI::getOptions ( )
Returns
array

◆ getParamDescription()

PFAutoeditAPI::getParamDescription ( )

Returns an array of parameter descriptions. Don't call this function directly: use getFinalParamDescription() to allow hooks to modify descriptions as needed.

Returns
array or false

◆ getStatus()

PFAutoeditAPI::getStatus ( )

Returns the HTTP status

200 - ok 400 - error

Returns
number

◆ getTextForPage()

PFAutoeditAPI::getTextForPage (   $title)

Helper function..

Parameters
Title$title
Returns
string

◆ getVersion()

PFAutoeditAPI::getVersion ( )

Returns a string that identifies the version of the class. Includes the class name, the svn revision, timestamp, and last author.

Returns
string

◆ isWriteMode()

PFAutoeditAPI::isWriteMode ( )

Indicates whether this module requires write mode

Returns
bool

◆ makeRandomNumber()

static PFAutoeditAPI::makeRandomNumber (   $numDigits = 1,
  $hasPadding = false 
)
static

Returns a formatted (pseudo) random number

Parameters
number$numDigitsthe min width of the random number
bool$hasPaddingshould the number should be padded with zeros instead of spaces?
Returns
number

◆ setHeaders()

PFAutoeditAPI::setHeaders ( )
protected

Set custom headers to attach to the answer

◆ setOption()

PFAutoeditAPI::setOption (   $option,
  $value 
)
Parameters
string$option
mixed$value

◆ setOptions()

PFAutoeditAPI::setOptions (   $options)
Parameters
array$options

◆ setResultFromOutput()

PFAutoeditAPI::setResultFromOutput ( )
protected

Sets the output HTML of wgOut as the module's result

Member Data Documentation

◆ DEBUG

const PFAutoeditAPI::DEBUG = 3

Error level used for debug messages.

◆ ERROR

const PFAutoeditAPI::ERROR = 0

Error level used when a non-recoverable error occurred.

◆ NOTICE

const PFAutoeditAPI::NOTICE = 2

Error level used to give information that might be of interest to the user.

◆ WARNING

const PFAutoeditAPI::WARNING = 1

Error level used when a recoverable error occurred.


The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy