[pmwiki-users] Please explain the IsEnabled function

Patrick R. Michaud pmichaud at pobox.com
Tue May 4 15:37:13 CDT 2010


On Mon, May 03, 2010 at 10:03:36PM -0400, DaveG wrote:
> >if (IsEnabled($EnableRobotCloakActions, 0 )) {
> >     blah blah
> >
> >If $EnableRobotCloakActions is set to 1, the blah blah should not
> >be executed?
>
> If it's already 1, then blah will be executed.
> If it's already 0, then blah will not be executed.

More precisely, blah blah is executed if $EnableRobotCloakActions
is explicitly set to a non-zero (true) value.

This is in contrast to something like

   if (IsEnabled($EnableXYZ, 1)) { blah blah }

where blah blah is executed unless $EnableXYZ has been explicitly
set to a zero (false) value.

The purpose of the function is to provide an easy way to specify
a default action without actually setting the configuration variable
(because we may later need to know that the configuration variable
was unset, as opposed to being programmatically set to a default).

Pm



More information about the pmwiki-users mailing list