Index: branches/5.0.x/core/install/install_toolkit.php =================================================================== diff -u -r12299 -r12416 --- branches/5.0.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 12299) +++ branches/5.0.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 12416) @@ -1,6 +1,6 @@ Application->recallObject('kXMLHelper'); + /* @var $xml_helper kXMLHelper */ + + $root_node =& $xml_helper->Parse( file_get_contents($info_file) ); + + if (!is_object($root_node) || !preg_match('/^kxmlnode/i', get_class($root_node)) || ($root_node->Name == 'ERROR')) { + // non-valid xml file + return Array (); + } + + $ret = Array (); + $current_node =& $root_node->firstChild; + + do { + $ret[ strtolower($current_node->Name) ] = trim($current_node->Data); + } while (($current_node =& $current_node->NextSibling())); + + return $ret; } /** + * Returns nice module string to be used on install/upgrade screens + * + * @param string $module_folder + * @param string $version_string + * @return string + */ + function getModuleString($module_folder, $version_string) + { + // image (if exists) ( ) + + $ret = Array (); + $module_info = $this->getModuleInfo($module_folder); + + if (array_key_exists('name', $module_info) && $module_info['name']) { + $module_name = $module_info['name']; + } + else { + $module_name = $this->getModuleName($module_folder); + } + + if (array_key_exists('image', $module_info) && $module_info['image']) { + $image_src = $module_info['image']; + + if (!preg_match('/^(http|https):\/\//', $image_src)) { + // local image -> make absolute url + $image_src = $this->Application->BaseURL() . $image_src; + } + + $ret[] = '' . htmlspecialchars($module_name) . ''; + } + + if (array_key_exists('description', $module_info) && $module_info['description']) { + $ret[] = $module_info['description']; + } + else { + $ret[] = $module_name; + } + + $ret[] = '(' . $module_name . ' ' . $version_string . ')'; + + return implode(' ', $ret); + } + + /** * Creates module root category in "Home" category using given data and returns it * * @param string $name