Remove numerous calls to in_array().

Replacing in_array() with isset() saves a number of calls which add up
over time.