function xlanguage_select_show($options = null) { include_once XOOPS_ROOT_PATH . "/modules/xlanguage/blocks/xlanguage_blocks.php"; if (empty($options)) { $options[0] = "images"; // display style: image, text, select $options[1] = " "; // delimitor $options[2] = 5; // items per line } $block = b_xlanguage_select_show($options); $block["tag"] = "xlanguage"; $content = ""; $i = 1; if (!empty($block["display"])) { //mb if (in_array($block["display"], array("images", "text"))) { foreach ($block["languages"] as $name => $lang) { $content .= "<a href=\"" . $block["url"] . $lang["name"] . "\" title=\"" . $lang["desc"] . "\">"; if ($block["display"] == "images") { $content .= "<img src=\"" . $lang["image"] . "\" alt=\"" . $lang["desc"] . "\""; if ($block["selected"] != $lang["name"]) { $content .= " style=\"MozOpacity: .8; opacity: .8; filter:Alpha(opacity=80);\""; } $content .= "/>"; } else { $content .= $lang["desc"]; } $content .= "</a>"; if ($i++ % $block["number"] == 0) { $content .= "<br />"; } } } else { $content .= "<select name=\"" . $block["tag"] . "\"\r\n\t\t\t\tonChange=\"if(this.options[this.selectedIndex].value.length >0 )\t{ window.document.location=this.options[this.selectedIndex].value;}\"\r\n\t\t\t\t>"; if (!empty($block["languages"])) { //mb foreach ($block["languages"] as $name => $lang) { $content .= "<option value=\"" . $block["url"] . $lang["name"] . "\""; if ($block["selected"] == $lang["name"]) { $content .= " selected "; } $content .= "/>" . $lang["desc"] . "</option>"; } } $content .= "</select>"; } } define("XLANGUAGE_SWITCH_CODE", $content); return true; }
/** * @param null $options * * @return bool */ function xlanguage_select_show($options = null) { $xoops = Xoops::getInstance(); if (!$xoops->registry()->get('XLANGUAGE_THEME_ENABLE')) { return false; } include_once \XoopsBaseConfig::get('root-path') . '/modules/xlanguage/blocks/xlanguage_blocks.php'; if (empty($options)) { $options[0] = 'images'; // display style: image, text, select $options[1] = ' '; // delimitor $options[2] = 5; // items per line } $block = b_xlanguage_select_show($options); $xoops->theme()->addStylesheet('modules/xlanguage/css/block.css'); $xoops->tpl()->assign('block', $block); $xlanguage_switch_code = "<div id='xo-language' class='" . $options[0] . "'>" . $xoops->tpl()->fetch('block:xlanguage/xlanguage_block.tpl') . "</div>"; $xoops->tpl()->assign('xlanguage_switch_code', $xlanguage_switch_code); return true; }