예제 #1
0
 /**
  * Loads a list of hooks from configuration table
  *
  * @return void
  */
 public static function load()
 {
     self::$hooks = array();
     self::$callbacks = array();
     $sm = vivvo_lite_site::get_instance();
     $configuration = $sm->get_configuration();
     $config = $configuration->get_configuration_property_list('vivvo_hooks');
     foreach ($config as $hookname => $handlers) {
         foreach ($handlers as $key => $val) {
             if ($callback = unserialize($val) and is_array($callback)) {
                 $key = $callback['key'];
                 $priority = $callback['priority'];
                 if (!is_array(self::$hooks[$hookname])) {
                     self::$hooks[$hookname] = array();
                 }
                 if (!is_array(self::$hooks[$hookname][$priority])) {
                     self::$hooks[$hookname][$priority] = array();
                 }
                 self::$hooks[$hookname][$priority][$key] = $callback;
                 if (!is_array(self::$callbacks[$key])) {
                     self::$callbacks[$key] = array();
                 }
                 self::$callbacks[$key][$hookname] = $priority;
             }
         }
     }
 }