Fix build list of widgets

Only consider files ending in ".php" to restrict widgets and avoid load
wrong files. It should fix #2761