* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class PLModule
+abstract class PLModule
{
- function handlers() { die("implement me"); }
+ abstract function handlers();
- function make_hook($fun, $auth, $perms = '', $type = DO_AUTH)
+ /** Register a hook
+ * @param fun name of the handler (the exact name will be handler_$fun)
+ * @param auth authentification level of needed to run this handler
+ * @param perms permission required to run this handler
+ * @param type additionnal flags
+ *
+ * Perms syntax is the following:
+ * perms = rights(,rights)*
+ * rights = right(:right)*
+ * right is an atomic right permission (like 'admin', 'user', 'groupadmin', 'groupmember'...)
+ *
+ * If type is set to NO_AUTH, the system will return 403 instead of asking auth data
+ * this is useful for Ajax handler
+ * If type is not set to NO_SKIN, the system will consider redirecting the user to https
+ */
+ public function make_hook($fun, $auth, $perms = 'user', $type = DO_AUTH)
{
return array('hook' => array($this, 'handler_'.$fun),
'auth' => $auth,
public static function factory($modname)
{
- $mod_path = dirname(__FILE__).'/../modules/'.strtolower($modname).'.php';
- $class = ucfirst($modname).'Module';
+ $mod_path = dirname(__FILE__) . '/../modules/' . $modname . '.php';
+ $class = ucfirst($modname) . 'Module';
require_once $mod_path;
return new $class();
}
}
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>