🌍
English
dev:changes_in_2.7 [2014/02/18 15:05] mistic100 created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Technical changes in Piwigo 2.7 ====== | ||
- | ===== add_event_handler() 4th parameter ===== | ||
- | The fourth parameter of *add_event_handler* function was used to tell the number of parameters which will be transmitted to the callback. This is no longer used: all parameters given to *trigger_change* or *trigger_notify* are always transmitted to all callback. | ||
- | |||
- | But the fourth parameter is still used: if a string is given it will be used as a file path included just before the callback (with *include_once*). | ||
- | <code php> | ||
- | // procedural | ||
- | add_event_handler('init', 'my_init', | ||
- | EVENT_HANDLER_PRIORITY_NEUTRAL, | ||
- | MY_PLUGIN_PATH . 'include/callbacks.php' | ||
- | ); | ||
- | |||
- | // OOP with static method | ||
- | add_event_handler('init', array('MyClass', 'init'), | ||
- | EVENT_HANDLER_PRIORITY_NEUTRAL, | ||
- | MY_PLUGIN_PATH . 'include/myclass.php' | ||
- | ); | ||
- | </code> | ||
- | |||
- | If the 4th parameter is anything else than a string it is ignored. |