Clean up `bp-core-template.php`:

* Add brackets where necessary.
* Wrap array/object references in `empty()` where necessary to avoid debug notices.
* Replace `$bp` global touches with `buddypress()` calls.
* Remove some trailing whitespace.
* Add some inline/phpdoc doc.
* Add filters to commonly used `_is_` functions.
* Clean-up logic in some `_is_` functions.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8698 cdf35c40-ae34-48e0-9cc9-0c9da1808c22