$urlTranslation = $urlSDK . 'translation_index.php'; ClaroBreadCrumbs::getInstance()->prepend(get_lang('Translation Tools'), $urlTranslation); ClaroBreadCrumbs::getInstance()->prepend(get_lang('SDK'), $urlSDK); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); include get_path('incRepositorySys') . '/claro_init_header.inc.php'; echo claro_html_tool_title($nameTools); if (isset($_REQUEST['cmd']) && $_REQUEST['cmd'] == 'generate') { $files = array(get_path('rootSys') . 'claroline/install/index.php'); $total_var_count = 0; $languageVarList = array(); foreach ($files as $file) { echo "<h4>" . $file . "</h4>\n"; // extract variables $scannedFileList = array(); // re init the scannedFileList for each new script $fileVarList = get_lang_vars_from_file($file); $sourceFile = file_get_contents($file); $tokenList = token_get_all($sourceFile); // $languageVarList = detect_get_lang($tokenList); echo 'Found ' . count($fileVarList) . ' Variables<br />' . "\n"; // display variables $var_count = 0; foreach ($fileVarList as $varName) { ++$var_count; } $total_var_count += $var_count; echo 'Total: ' . $total_var_count; $languageVarList = array_merge($languageVarList, $fileVarList); } $languageVarList = array_unique($languageVarList); $installVarList = array();
// drop table if exists $sql = "DROP TABLE IF EXISTS " . $tbl_used_lang . " "; mysql_query($sql) or die($problemMessage); // create table $sql = "CREATE TABLE " . $tbl_used_lang . " (\n id INTEGER NOT NULL auto_increment,\n varName VARCHAR(250) BINARY NOT NULL,\n langFile VARCHAR(250) NOT NULL,\n sourceFile VARCHAR(250) NOT NULL,\n INDEX index_varName (varName),\n PRIMARY KEY(id))"; mysql_query($sql) or die($problemMessage . __LINE__); // get lang vars from fies in claroline folder $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(get_path('clarolineRepositorySys'))); $allLanguageVarList = array(); echo '<ul>' . "\n"; foreach ($it as $file) { if ($file->isFile() && substr($file->getFilename(), -17) == '.def.conf.inc.php') { $languageVarList = get_lang_vars_from_deffile($file->getPathname()); echo '<li>' . count($languageVarList) . ' in DEF file <b>' . $file->getPathname() . '</b></li>' . "\n"; } elseif ($file->isFile() && substr($file->getFilename(), -4) == '.php') { $languageVarList = get_lang_vars_from_file($file->getPathname()); echo '<li>' . count($languageVarList) . ' in <b>' . $file->getPathname() . '</b></li>' . "\n"; } elseif ($file->isFile() && $file->getFilename() == 'manifest.xml') { // find first <name>Exercises</name> using preg_match $manifestContent = file_get_contents($file->getPathName()); $languageVarList = array(); $matches = array(); if (preg_match('!<name>([^<]+)</name>!i', $manifestContent, $matches)) { if (is_array($matches[1])) { $languageVarList[] = $matches[1][0]; } else { $languageVarList[] = $matches[1]; } } echo '<li>' . count($languageVarList) . ' in <b>' . $file->getPathname() . '</b></li>' . "\n"; } else {