You can now define custom expression functions in the expression widget. See this blog post for more details.
This application was created by Kartoza (Pty) Ltd. Available on GitHub! Version: 2.3.1