mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-10 07:04:53 +08:00
Remove unnecessary code
This commit is contained in:
parent
6f4be3edce
commit
2c68f039ae
2 changed files with 1 additions and 76 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
/.idea
|
||||
/.vscode
|
||||
/api.php
|
||||
/error.log
|
||||
/nbproject
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
\define('IS_ADMIN', isset($_GET['admin']) && '1' === (string) $_GET['admin']);
|
||||
\define('LANGS_PATH', __DIR__.'/../rainloop/v/0.0.0/langs'.(IS_ADMIN ? '/admin' : ''));
|
||||
|
||||
function getLangStructure($sLangFile)
|
||||
{
|
||||
$sEngLang = \file_get_contents(LANGS_PATH.'/'.$sLangFile);
|
||||
return $sEngLang ? \parse_ini_string($sEngLang, true) : null;
|
||||
}
|
||||
|
||||
function mergeLangStructure($aFromLang, $aEngLang, &$iCount = 0)
|
||||
{
|
||||
$iCount = 0;
|
||||
foreach ($aEngLang as $sSectionKey => $aSectionValue)
|
||||
{
|
||||
foreach (\array_keys($aSectionValue) as $sParamKey)
|
||||
{
|
||||
if (isset($aFromLang[$sSectionKey][$sParamKey]))
|
||||
{
|
||||
$aEngLang[$sSectionKey][$sParamKey] = $aFromLang[$sSectionKey][$sParamKey];
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $sSectionKey.'/'.$sParamKey.','."\n";
|
||||
$iCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aEngLang;
|
||||
}
|
||||
|
||||
function saveLangStructure($sLangFile, $aLang)
|
||||
{
|
||||
$aResultLines = array();
|
||||
// $aResultLines[] = '; '.$sLangFile;
|
||||
|
||||
foreach ($aLang as $sSectionKey => $aSectionValue)
|
||||
{
|
||||
$aResultLines[] = '';
|
||||
$aResultLines[] = '['.$sSectionKey.']';
|
||||
|
||||
foreach ($aSectionValue as $sParamKey => $sParamValue)
|
||||
{
|
||||
$aResultLines[] = $sParamKey.' = "'.
|
||||
\str_replace(array('\\', '"'), array('\\\\', '\\"'), \trim($sParamValue)).'"';
|
||||
}
|
||||
}
|
||||
|
||||
\file_put_contents(LANGS_PATH.'/'.$sLangFile, implode("\n", $aResultLines)."\n");
|
||||
}
|
||||
|
||||
$sNL = "\n";
|
||||
$aEngLang = \getLangStructure('en.ini');
|
||||
|
||||
$aFiles = \glob(LANGS_PATH.'/*.ini');
|
||||
foreach ($aFiles as $sFile)
|
||||
{
|
||||
$iCount = 0;
|
||||
$sFileName = \basename($sFile);
|
||||
|
||||
$aNextLang = \getLangStructure($sFileName);
|
||||
$aNewLang = \mergeLangStructure($aNextLang, $aEngLang, $iCount);
|
||||
|
||||
if (0 === $iCount)
|
||||
{
|
||||
echo $sFileName.': ok'.$sNL;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $sFileName.': changed ('.$iCount.')'.$sNL;
|
||||
}
|
||||
|
||||
// \saveLangStructure($sFileName, $aNewLang);
|
||||
}
|
Loading…
Add table
Reference in a new issue