Your comment reminded me to check again the usage of "include" and "require" functions. Take a look at this: http://stackoverflow.com/questions/2418473/when-should-i-use-require-once-vs-include (that made me change the code).

Now, answering you: there is no problem using them inside functions as the requirement is only for the local code. Think of this as a library function, not as an entity functionality. =]