The code needs to be optimized; i.e., decounter_exit() uses two variables when it needs only one ($admin, and $exclude_admin). It's enough to initialize the second variable with $exclude_admin = (integer) variable_get(...).

Comments

avpaderno’s picture

The code I am talking of is the following

 $admin = variable_get('decounter_exclude_admin', '1');
  
  if ($admin == '1') {
    $exclude_admin = TRUE;
  }

which could be simply write

 $exclude_admin = (boolean) variable_get('decounter_exclude_admin', 1);

This would also avoid the access to a not defined variable that happens in the case variable_get('decounter_exclude_admin', '1') returns a value different from '1'.

avpaderno’s picture

Then, also the line

if (($active == 1) && (arg(0) == 'node') && (is_numeric(arg(1))) && (arg(2) == '') && (($exclude_admin) OR ($active_role))) {

can be simplified in

if ($active && arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '' && ($exclude_admin || $active_role)) {
Anonymous’s picture

Everybody has it's own style of programming.

Anonymous’s picture

Assigned: Unassigned »
Status: Active » Postponed
Anonymous’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.