* add tools

This commit is contained in:
滔哥
2017-11-06 09:31:45 +08:00
parent 22eb945187
commit cb85e011a6
12 changed files with 776 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
error_reporting(E_ALL);
$langType = empty($argv[1]) ? 'zh-cn' : $argv[1];
$modules = glob('../module/*');
$maxLength = 0;
foreach($modules as $modulePath)
{
$moduleName = basename($modulePath);
if(strlen($moduleName) > $maxLength) $maxLength = strlen($moduleName);
}
foreach($modules as $modulePath)
{
$moduleName = basename($modulePath);
if($moduleName == 'help' or $moduleName == 'editor') continue;
$langFile = $modulePath . "/lang/$langType.php";
if(!file_exists($langFile)) continue;
include $langFile;
$moduleTitle = '';
if(isset($lang->$moduleName->common))
{
$moduleTitle = $lang->$moduleName->common;
}
echo "\$lang->editor->modules['$moduleName'] " . str_pad('', $maxLength - strlen($moduleName)) . "= '$moduleTitle';\n";
}