function xlanguage_encoding($output) { global $xlanguage; $output = xlanguage_ml($output); // escape XML doc if (preg_match("/^\\<\\?[\\s]?xml[\\s]+version=([\"'])[^\\>]+\\1[\\s]+encoding=([\"'])[^\\>]+\\2[\\s]?\\?\\>/i", $output)) { return $output; } $in_charset = $xlanguage["charset_base"]; $out_charset = $xlanguage["charset"]; return $output = xlanguage_convert_encoding($output, $out_charset, $in_charset); }
$lang = $helper->getHandlerLanguage()->getByName($xlanguage['lang']); if (is_array($lang) && strcasecmp($lang['xlanguage_name'], $helper->getConfig('language'))) { $xoops->setConfig('locale', $lang['xlanguage_name']); if ($lang['xlanguage_charset']) { $xlanguage['charset'] = $lang['xlanguage_charset']; } if ($lang['xlanguage_code']) { $xlanguage['code'] = $lang['xlanguage_code']; } } unset($lang); $xoops->registry()->set('XLANGUAGE_HANDLER', $helper->getHandlerLanguage()); if ($xlanguage['action']) { //if(CONV_REQUEST && (!empty($_GET)||!empty($_POST))){ if (!empty($_POST)) { $in_charset = $xlanguage['charset']; $out_charset = $xlanguage['charset_base']; //$CONV_REQUEST_array=array('_GET', '_POST'); $CONV_REQUEST_array = array('_POST'); foreach ($CONV_REQUEST_array as $HV) { if (!empty(${$HV})) { ${$HV} = xlanguage_convert_encoding(${$HV}, $out_charset, $in_charset); } $GLOBALS['HTTP' . $HV . '_VARS'] = ${$HV}; } } ob_start('xlanguage_encoding'); } else { ob_start('xlanguage_ml'); } $xoops->registry()->set('XLANGUAGE', $xlanguage);
/** * @param string $output * * @return array|mixed|string */ function xlanguage_encoding($output) { $xoops = Xoops::getInstance(); $xlanguage = $xoops->registry()->get('XLANGUAGE'); $output = xlanguage_ml($output); // escape XML doc if (preg_match("/^\\<\\?[\\s]?xml[\\s]+version=([\"'])[^\\>]+\\1[\\s]+encoding=([\"'])[^\\>]+\\2[\\s]?\\?\\>/i", $output)) { return $output; } $in_charset = $xlanguage['charset_base']; $out_charset = $xlanguage['charset']; return $output = xlanguage_convert_encoding($output, $out_charset, $in_charset); }