Add MetaHeader event to add template to scripts

Scripts are template dependent as well, but DokuWiki does not provide a way to set a template inside js.php - it has to be done via the INIT_LANG_LOAD event which is after initialization and before anything is being done in js.php.

Within the TPL_METAHEADER_OUTPUT event we need to prepare for this behavior and add the template to all Script/Src elements in the headers.
Fix for the array_keys problem.
Again the array. PHP<5.4 does not know how to pull an element from a function.