[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> ActionRouter.php (summary)

(no description)

File Size: 228 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ActionRouter:: (8 methods):
  __construct()
  getInstance()
  setupAction()
  transitionAction()
  handleFatalException()
  loadAction()
  checkAction()
  getAction()


Class: ActionRouter  - X-Ref

Class ActionRouter

__construct()   X-Ref
ActionRouter constructor. Singleton, thus protected!

Sets up the correct action based on the $ACT global. Writes back
the selected action to $ACT

getInstance($reinit = false)   X-Ref
Get the singleton instance

param: bool $reinit
return: ActionRouter

setupAction(&$actionname)   X-Ref
Setup the given action

Instantiates the right class, runs permission checks and pre-processing and
sets $action

triggers: ACTION_ACT_PREPROCESS
param: string $actionname this is passed as a reference to $ACT, for plugin backward compatibility

transitionAction($from, $to, $e = null)   X-Ref
Transitions from one action to another

Basically just calls setupAction() again but does some checks before.

param: string $from current action name
param: string $to new action name
param: null|ActionException $e any previous exception that caused the transition

handleFatalException(\Exception $e)   X-Ref
Aborts all processing with a message

When a FataException instanc is passed, the code is treated as Status code

param: \Exception|FatalException $e

loadAction($actionname)   X-Ref
Load the given action

This translates the given name to a class name by uppercasing the first letter.
Underscores translate to camelcase names. For actions with underscores, the different
parts are removed beginning from the end until a matching class is found. The instatiated
Action will always have the full original action set as Name

Example: 'export_raw' -> ExportRaw then 'export' -> 'Export'

param: $actionname
return: AbstractAction

checkAction(AbstractAction $action)   X-Ref
Execute all the checks to see if this action can be executed

param: AbstractAction $action

getAction()   X-Ref
Returns the action handling the current request

return: AbstractAction