fix module name to untranslated string, fix dcmin search

master
Jean-Christian Paul Denis 2021-09-25 21:13:56 +02:00
parent 1fd9c7bf6e
commit fcdfd7e3ba
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 18 additions and 4 deletions

View File

@ -21,6 +21,7 @@ class tweakStores
{ {
$label = empty($module['label']) ? $id : $module['label']; $label = empty($module['label']) ? $id : $module['label'];
$name = __(empty($module['name']) ? $label : $module['name']); $name = __(empty($module['name']) ? $label : $module['name']);
$oname = empty($module['name']) ? $label : $module['name'];
return array_merge( return array_merge(
# Default values # Default values
@ -42,7 +43,7 @@ class tweakStores
'sshot' => '', 'sshot' => '',
'score' => 0, 'score' => 0,
'type' => null, 'type' => null,
'require' => [], 'requires' => [],
'settings' => [], 'settings' => [],
'repository' => '', 'repository' => '',
'dc_min' => 0 'dc_min' => 0
@ -55,6 +56,7 @@ class tweakStores
'sid' => self::sanitizeString($id), 'sid' => self::sanitizeString($id),
'label' => $label, 'label' => $label,
'name' => $name, 'name' => $name,
'oname' => $oname,
'sname' => self::sanitizeString($name) 'sname' => self::sanitizeString($name)
] ]
); );
@ -107,7 +109,7 @@ class tweakStores
if (empty($module['name'])) { if (empty($module['name'])) {
self::$failed[] = 'no module name set in _define.php'; self::$failed[] = 'no module name set in _define.php';
} }
$xml[] = sprintf('<name>%s</name>', html::escapeHTML($module['name'])); $xml[] = sprintf('<name>%s</name>', html::escapeHTML($module['oname']));
# version # version
if (empty($module['version'])) { if (empty($module['version'])) {
@ -140,11 +142,23 @@ class tweakStores
} }
$xml[] = sprintf('<file>%s</file>', html::escapeHTML($file_pattern)); $xml[] = sprintf('<file>%s</file>', html::escapeHTML($file_pattern));
# dc_min # da dc_min or requires core
if (!empty($>module['requires']) && is_array($module['requires'])) {
foreach ($module['requires'] as $req) {
if (!is_array($req)) {
$req = [$req];
}
if ($req[0] == 'core') {
$module['dc_min'] = $req[1];
break;
}
}
}
if (empty($module['dc_min'])) { if (empty($module['dc_min'])) {
self::$notice[] = 'no minimum dotclear version'; self::$notice[] = 'no minimum dotclear version';
} else {
$xml[] = sprintf('<da:dcmin>%s</da:dcmin>', html::escapeHTML($module['dc_min']));
} }
$xml[] = sprintf('<da:dcmin>%s</da:dcmin>', html::escapeHTML($module['dc_min']));
# details # details
if (empty($module['details'])) { if (empty($module['details'])) {