Improve the include / exclude SQL generation in `get_terms()` by using `IN` and `NOT IN` where applicable. Adds unit tests for include / exclude.

Props sirzooro, duck_.

Fixes #11823.



git-svn-id: https://develop.svn.wordpress.org/trunk@25162 602fd350-edb4-49c9-b593-d223f7449a82