Add ordering to event handlers

Allows a sequence integer to be supplied when registering to handle
an event.  When processing an event, handlers (hooks) will be
executed in ascending order of their sequence number.  If two or
more handlers have the same sequence number their order of
execution is undefined.

A handler wanting to be first, should use -PHP_MAX_INT.
A handler wanting to be last can use PHP_MAX_INT.
There may be conflicts if two or more plugins use these values in
the expectation that they will guarantee being first or last.
Merge pull request #552 from splitbrain/event_handler_sequencing

Add ordering to event handlers