Remove unnecesary wildcards from dynamic parameter query

Don't force to add .* wildcard at the end of the queryurl when using
Dynamic parameters. The user can add it if necessary, and when using
very short queries (i.e. first level) can result in a lot of undesired
results returned from graphite queryurl, making unnecessary loops in the
each loop for returned metrics.
Reduce unnecessary array sort calls

There is no need to call array().sort in every iteration of the each
loop. Instead call it only once at the end of the loop.