Exemple #1
0
 public static function xmlToArray($xml, $isNormal = false)
 {
     $xmlParser = new XMLParse($isNormal);
     $data = $xmlParser->parse($xml);
     $xmlParser->destruct();
     return $data;
 }
Exemple #2
0
/**
 * List the installed language packs. 
 * @return 
 */
function show_packs()
{
    $frm = e107::getForm();
    $ns = e107::getRender();
    $tp = e107::getParser();
    if (is_readable(e_ADMIN . "ver.php")) {
        include e_ADMIN . "ver.php";
        list($ver, $tmp) = explode(" ", $e107info['e107_version']);
    }
    $lans = getLanList();
    $release_diz = defined("LANG_LAN_30") ? LANG_LAN_30 : "Release Date";
    $compat_diz = defined("LANG_LAN_31") ? LANG_LAN_31 : "Compatibility";
    $lan_pleasewait = deftrue('LAN_PLEASEWAIT') ? $tp->toJS(LAN_PLEASEWAIT) : "Please Wait";
    $lan_displayerrors = deftrue('LANG_LAN_33') ? LANG_LAN_33 : "Display only errors during verification";
    $text = "<form id='lancheck' method='post' action='" . e_SELF . "?tools'>\n\t\t\t<table class='table table-striped'>";
    $text .= "<thead>\n\t\t<tr>\n\t\t<th>" . ADLAN_132 . "</th>\n\t\t<th>" . $release_diz . "</th>\t\t\n\t\t<th>" . $compat_diz . "</th>\n\t\t<th>" . LAN_STATUS . "</td>\n\t\t<th style='width:25%;white-space:nowrap'>" . LAN_OPTIONS . "</td>\n\t\t</tr>\n\t\t</thead>\n\t\t";
    require_once e_HANDLER . "xml_class.php";
    $xm = new XMLParse();
    foreach ($lans as $language) {
        if ($language == "English") {
            continue;
        }
        $metaFile = e_LANGUAGEDIR . $language . "/" . $language . ".xml";
        if (is_readable($metaFile)) {
            $rawData = file_get_contents($metaFile);
            if ($rawData) {
                $array = $xm->parse($rawData);
                $value = $array['e107Language']['attributes'];
            } else {
                $value = array('date' => "&nbsp;", 'compatibility' => '&nbsp;');
            }
        } else {
            $value = array('date' => "&nbsp;", 'compatibility' => '&nbsp;');
        }
        $errFound = isset($_SESSION['lancheck'][$language]['total']) && $_SESSION['lancheck'][$language]['total'] > 0 ? TRUE : FALSE;
        $text .= "<tr>\n\t\t\t<td >" . $language . "</td>\n\t\t\t<td>" . $value['date'] . "</td>\n\t\t\t<td>" . $value['compatibility'] . "</td>\n\t\t\t<td>" . ($ver != $value['compatibility'] || $errFound ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON) . "</td>\n\t\t\t<td><input type='submit' name='language_sel[{$language}]' value=\"" . LAN_CHECK_2 . "\" class='btn btn-primary' />\n\t\t\t<input type='submit' name='ziplang[{$language}]' value=\"" . LANG_LAN_23 . "\" class='button' onclick=\"this.value = '" . $lan_pleasewait . "'\" /></td>\t\n\t\t\t</tr>";
    }
    $text .= "\n\t\t\n\t\t</tr></table>";
    $text .= "<table class='table table-striped'>";
    $text .= "<thead><tr><th>" . LAN_OPTIONS . "</th></tr></thead><tbody>";
    $srch = array("[", "]");
    $repl = array("<a rel='external' href='http://e107.org/content/About-Us:The-Team#translation-team'>", "</a>");
    $diz = deftrue("LANG_LAN_28") ? LANG_LAN_28 : "Check this box if you're an [e107 certified translator].";
    $checked = varset($_COOKIE['e107_certified']) == 1 ? true : false;
    $text .= "<tr><td>";
    $text .= $frm->checkbox('contribute_pack', 1, $checked, array('label' => str_replace($srch, $repl, $diz)));
    $text .= "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td>";
    $echecked = varset($_SESSION['lancheck-errors-only']) == 1 ? true : false;
    $text .= $frm->checkbox('errorsonly', 1, $echecked, array('label' => $lan_displayerrors));
    $text .= " </td>\n\t\t\n\t\t</tr>";
    //		$text .= "
    //		<tr>
    //		<td>".$frm->checkbox('non-core-plugs-themes',1,$echecked,array('label'=>$lan_displayerrors))."</td>
    //		</tr>
    //		";
    $text .= "</tbody></table>";
    $text .= "</form>";
    $text .= "<div class='smalltext center' style='padding-top:50px'>" . LANG_LAN_AGR . "</div>";
    $ns->tablerender(ADLAN_132 . SEP . LANG_LAN_32, $text);
    return;
}