function o_flat_array($array) { if (!is_array($array)) { return array(); } $out = array(); foreach ($array as $k => $v) { if (is_array($array[$k]) && o_isAssoc($array[$k])) { $out += o_flat_array($array[$k]); } else { $out[$k] = $v; } } return $out; }
if (!isset($_SESSION[$module->module . 'a'][$module->id])) { $_SESSION[$module->module . 'a'] = array(); $a = $params->toArray(); $a['params'] = $a; $params->loadArray($a); $_SESSION[$module->module . "_orig"] = $params->toString(); $_SESSION[$module->module . 'a'][$module->id] = true; $_SESSION[$module->module . "_params"] = $params->toString(); header('LOCATION: ' . $_SERVER['REQUEST_URI']); } if (isset($_SESSION[$module->module . "_params"])) { $params = new JRegistry(); $params->loadJSON($_SESSION[$module->module . "_params"]); } $a = $params->toArray(); $params->loadArray(o_flat_array($a['params'])); $themesdir = JPATH_SITE . '/modules/' . $module->module . '/themes/'; $xmlFile = $themesdir . $params->get('theme', 'elegant') . '/theme.xml'; $xml = new SimpleXMLElement(file_get_contents($xmlFile)); $skins = $xml->params[0]->param[0]; $sks = array(); foreach ($skins->children() as $skin) { $sks[] = $skin->getName(); } DojoLoader::addScript('window.skin = new Skinchanger({theme: "' . $params->get('theme', 'elegant') . '",skins: ' . json_encode($sks) . '});'); if (isset($_REQUEST['skin']) && $skins->{$_REQUEST['skin']}) { $skin = $skins->{$_REQUEST['skin']}[0]; foreach ($skin as $s) { $name = $s->getName(); $value = (string) $s; $params->set($name, $value);