diff --git a/include/class_config.inc b/include/class_config.inc index cbae9d07ffcc34f56887bece3253eb9105a9497e..169c4fcdf7c000252820ebade38551987d19d060 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -484,6 +484,10 @@ class config $class = strtoupper($parts[0]); $mode = strtoupper($parts[1]); $cmd = $parts[2]; + if (!isset($cmd[0]) || ($cmd[0] == '#')) { + /* Ignore commented out and empty triggers */ + continue; + } if (!isset($this->data['HOOKS'][$class])) { $this->data['HOOKS'][$class] = ['CLASS' => $parts[0]]; } diff --git a/plugins/config/class_hooksConfig.inc b/plugins/config/class_hooksConfig.inc index d0dcc4efff5b7e09367d30996bfa86eda2881ba4..759543f7894e6845605a10f1a9070cd503da1d77 100644 --- a/plugins/config/class_hooksConfig.inc +++ b/plugins/config/class_hooksConfig.inc @@ -70,13 +70,19 @@ class hooksConfig extends simplePlugin 'precreate', 'preremove', 'premodify', 'check', 'prelock', 'postlock', 'preunlock', 'postunlock'] ), + new BooleanAttribute( + _('Deactivated'), _('Use this to temporarily deactivate a trigger'), + 'triggerDecativate', TRUE, + FALSE, '', + '#', '' + ), new TextAreaAttribute( _('Command'), _('The command that will be called'), 'triggerCmd', TRUE ) ], - '/^([^\\|]+)\\|([^\\|]+)\\|(.*)$/', - '%s|%s|%s', + '/^([^\\|]+)\\|([^\\|]+)\\|(#?)(.*)$/', + '%s|%s|%s%s', '', // acl _('Triggers') ), @@ -99,6 +105,7 @@ class hooksConfig extends simplePlugin $this->attributesAccess['fdTabHook']->setHeaders([ _('Tab'), _('Mode'), + _('Deactivated'), _('Command'), '', ]);