simply it's better

master
Jean-Christian Paul Denis 2021-08-28 02:45:38 +02:00
parent 1bc7b2c237
commit 1fd9c7bf6e
1 changed files with 3 additions and 5 deletions

View File

@ -57,11 +57,10 @@ class tweakStoresBehaviors
protected static function modulesToolsTabs(dcCore $core, $modules, $excludes, $page_url) protected static function modulesToolsTabs(dcCore $core, $modules, $excludes, $page_url)
{ {
$file_pattern = $core->blog->settings->tweakStores->file_pattern; $file_pattern = $core->blog->settings->tweakStores->file_pattern;
$modules = new ArrayObject($modules);
$combo = self::comboModules($modules, $excludes); $combo = self::comboModules($modules, $excludes);
# generate xml code # generate xml code
if (!empty($_POST['buildxml_id']) && $modules->offsetExists($_POST['buildxml_id'])) { if (!empty($_POST['buildxml_id']) && in_array($_POST['buildxml_id'], $combo)) {
$xml_content = tweakStores::generateXML($_POST['buildxml_id'], $modules[$_POST['buildxml_id']], $file_pattern); $xml_content = tweakStores::generateXML($_POST['buildxml_id'], $modules[$_POST['buildxml_id']], $file_pattern);
} }
@ -173,12 +172,11 @@ class tweakStoresBehaviors
} }
# create list of module for combo and remove official modules # create list of module for combo and remove official modules
protected static function comboModules(arrayObject $modules, $excludes) protected static function comboModules($modules, array $excludes)
{ {
$combo = [ __('Select a module') => '0']; $combo = [ __('Select a module') => '0'];
foreach ($modules as $id => $module) { foreach ($modules as $id => $module) {
if (is_array($excludes) && in_array($id, $excludes)) { if (in_array($id, $excludes)) {
$modules->offsetUnset($id);
continue; continue;
} }
$combo[$module['name'] . ' '. $module['version']] = $id; $combo[$module['name'] . ' '. $module['version']] = $id;