/** * @return array */ public static function getTemplates() { static $types = null; if ($types === null) { $types = array(); $path = wa('shop')->getConfig()->getConfigPath('data/welcome/', false); if (file_exists($path)) { $files = waFiles::listdir($path, false); foreach ($files as $file) { if (preg_match('/^type_([a-z]\\w+)\\.php$/', $file, $matches)) { $types[$matches[1]] = (include $path . $file); } } } $locale_path = $path . 'locale/' . wa()->getUser()->getLocale() . '.php'; if (file_exists($locale_path)) { self::$translate = (include $locale_path); if (!is_array(self::$translate)) { self::$translate = array(); } } if (!empty($types)) { foreach ($types as $id => &$type) { $name = ifempty($type['name'], $id); $type['name'] = ifempty(self::$translate[$name], $name); $type += array('icon' => '', 'description' => ''); } } } return $types; }