Adds a simple way to count queries over a piece of code
Fix #6238 Return blank arrays 

I committed this simple change to return the empty array rather than false for empty settings result for ElggPlugin::getAllSettings and getAllUsersSettings. Put this into 1.8 branch.
Fixes #6258: Pagination uses HTTP referrer as default base_url for Ajax requests
Merge pull request #6263 from mrclay/6258

Fixes #6258: Pagination uses HTTP referrer as default base_url for Ajax requests
Fixes #6024: Adds support for ":before" and ":after" events
After events cannot be cancelled, all handlers always run.

Conflicts:
	engine/lib/elgglib.php
Improved inline docs
Clearer logic
RST docs for before/after events
More reliable event deprecation (notice only if handlers registered)
Switch login to before/after events
Switch logout event to before/after
Handle case if get_user_notification_settings() returns false
Merge pull request #6250 from edfactor/patch-1

Makes sure plugin settings functions return arrays
Fixes #6012: Gets correct client IP behind proxy (1.8)
Checks X-Real-Ip header as well when determining client IP
Merge remote-tracking branch 'origin/1.8'
Corrects testUnstoppableEventsCantBeStoppedAndReturnTrue test
Bug fix in elgg_trigger_deprecated_event
Merge branch 'pr/6026'
Merge pull request #6239 from mrclay/query_counter

Adds a simple way to count queries over a piece of code