Trim search string input

Trim search string input fixes #4945
Abstract getting search string into another method

Abstract getting search string into another method, also allows over-riding.
Fixed travis errors.
PHPCS White-space error caused by GitHub editor.
No more method abstraction.
Merge pull request #4946 from bweston92/staging

Trim search string input in language overrides