Changeset 27335


Ignore:
Timestamp:
Feb 11, 2014, 10:45:55 PM (7 years ago)
Author:
rvelices
Message:

small optim on events trigger when several handlers are registered (no more array_slice inside the loop)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_plugins.inc.php

    r27238 r27335  
    280280  }
    281281  $args = func_get_args();
     282  array_shift($args);
    282283
    283284  foreach ($pwg_event_handlers[$event] as $priority => $handlers)
     
    285286    foreach ($handlers as $handler)
    286287    {
    287       $args[1] = $data;
     288      $args[0] = $data;
    288289
    289290      if (!empty($handler['include_path']))
     
    292293      }
    293294
    294       $data = call_user_func_array($handler['function'], array_slice($args, 1));
     295      $data = call_user_func_array($handler['function'], $args);
    295296    }
    296297  }
     
    342343  }
    343344  $args = func_get_args();
     345  array_shift($args);
    344346
    345347  foreach ($pwg_event_handlers[$event] as $priority => $handlers)
     
    352354      }
    353355
    354       call_user_func_array($handler['function'], array_slice($args,1));
     356      call_user_func_array($handler['function'], $args);
    355357    }
    356358  }
Note: See TracChangeset for help on using the changeset viewer.