Commit 0153140a9bb945cc4f92d4e080224000c9dddfd0

Authored by nbm
1 parent d9582107

Add a registry to handle triggers, user-configurable activities that can

occur at various stages during an action (such as the "post-validator"
stage of the "add document" action).


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3916 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/triggers/triggerregistry.inc.php 0 → 100644
  1 +<?php
  2 +
  3 +class KTTriggerRegistry {
  4 + var $triggers = array();
  5 + // {{{ getSingleton
  6 + function &getSingleton () {
  7 + if (!KTUtil::arrayGet($GLOBALS, 'oKTTriggerRegistry')) {
  8 + $GLOBALS['oKTTriggerRegistry'] = new KTTriggerRegistry;
  9 + }
  10 + return $GLOBALS['oKTTriggerRegistry'];
  11 + }
  12 + // }}}
  13 +
  14 + // {{{ registerTrigger
  15 + function registerTrigger($action, $slot, $name, $nsname, $path = "") {
  16 + if (!array_key_exists($action, $this->triggers)) {
  17 + $this->triggers[$action] = array();
  18 + }
  19 + if (!array_key_exists($slot, $this->triggers[$action])) {
  20 + $this->triggers[$action][$slot] = array();
  21 + }
  22 + $this->triggers[$action][$slot][$nsname] = array($name, $path, $nsname);
  23 + }
  24 + // }}}
  25 +
  26 + // {{{ getTriggers
  27 + function getTriggers($action, $slot) {
  28 + return $this->triggers[$action][$slot];
  29 + }
  30 + // }}}
  31 +}
  32 +
  33 +?>
... ...