This is a custom function. At the moment, this function get all the file in the default directory, strip \".php\" and list them.
The problem is that I want to only
You need to change the regular expression in preg_grep:
$files = preg_grep('~^tpl-.*\.php$~', scandir(admin . "templates/default/"));
Explanation:
^tpl- - starting with "tpl-"
^tpl-
.* - any characters
.*
\.php$ - ending with ".php"
\.php$