mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
allow users to configure a closure (anonymous function) as a *_struct_hook config setting as well
previously we required a named function, see #1069
This commit is contained in:
2 files changed
+7
-1
No files matched your search
@@ -372,6 +372,11 @@ function maildir_name_hook($domain, $user) {
|
||||
return $struct; # important!
|
||||
}
|
||||
$CONF['admin_struct_hook'] = 'x_struct_admin_modify';
|
||||
|
||||
You can also use e.g.
|
||||
$CONF['admin_struct_hook'] = function($struct) { // logic
|
||||
return $struct; }
|
||||
);
|
||||
*/
|
||||
$CONF['admin_struct_hook'] = '';
|
||||
$CONF['domain_struct_hook'] = '';
|
||||
|
||||
@@ -239,8 +239,9 @@ abstract class PFAHandler
|
||||
);
|
||||
}
|
||||
|
||||
// default *_struct_hooks are empty strings
|
||||
$struct_hook = Config::read($this->db_table . '_struct_hook');
|
||||
if (!empty($struct_hook) && is_string($struct_hook) && $struct_hook != 'NO' && function_exists($struct_hook)) {
|
||||
if (!empty($struct_hook) && $struct_hook != 'NO' && is_callable($struct_hook)) {
|
||||
$this->struct = $struct_hook($this->struct);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user