mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°2969 - Add support for dictionaries folder in modules
This commit is contained in:
@@ -256,18 +256,21 @@ class MFModule
|
||||
public function GetDictionaryFiles()
|
||||
{
|
||||
$aDictionaries = array();
|
||||
if ($hDir = opendir($this->sRootDir))
|
||||
foreach (array($this->sRootDir, $this->sRootDir.'/dictionary') as $sRootDir)
|
||||
{
|
||||
while (($sFile = readdir($hDir)) !== false)
|
||||
if ($hDir = @opendir($sRootDir))
|
||||
{
|
||||
$aMatches = array();
|
||||
if (preg_match("/^[^\\.]+.dict.".$this->sName.'.php$/i', $sFile,
|
||||
$aMatches)) // Dictionary files are named like <Lang>.dict.<ModuleName>.php
|
||||
while (($sFile = readdir($hDir)) !== false)
|
||||
{
|
||||
$aDictionaries[] = $this->sRootDir.'/'.$sFile;
|
||||
$aMatches = array();
|
||||
if (preg_match("/^[^\\.]+.dict.".$this->sName.'.php$/i', $sFile,
|
||||
$aMatches)) // Dictionary files are named like <Lang>.dict.<ModuleName>.php
|
||||
{
|
||||
$aDictionaries[] = $sRootDir.'/'.$sFile;
|
||||
}
|
||||
}
|
||||
closedir($hDir);
|
||||
}
|
||||
closedir($hDir);
|
||||
}
|
||||
|
||||
return $aDictionaries;
|
||||
@@ -466,18 +469,21 @@ class MFDictModule extends MFModule
|
||||
public function GetDictionaryFiles()
|
||||
{
|
||||
$aDictionaries = array();
|
||||
if ($hDir = opendir($this->sRootDir))
|
||||
foreach (array($this->sRootDir, $this->sRootDir.'/dictionary') as $sRootDir)
|
||||
{
|
||||
while (($sFile = readdir($hDir)) !== false)
|
||||
if ($hDir = @opendir($sRootDir))
|
||||
{
|
||||
$aMatches = array();
|
||||
if (preg_match("/^.*dictionary\\.itop.*.php$/i", $sFile,
|
||||
$aMatches)) // Dictionary files are named like <Lang>.dict.<ModuleName>.php
|
||||
while (($sFile = readdir($hDir)) !== false)
|
||||
{
|
||||
$aDictionaries[] = $this->sRootDir.'/'.$sFile;
|
||||
$aMatches = array();
|
||||
if (preg_match("/^.*dictionary\\.itop.*.php$/i", $sFile,
|
||||
$aMatches)) // Dictionary files are named like <Lang>.dict.<ModuleName>.php
|
||||
{
|
||||
$aDictionaries[] = $sRootDir.'/'.$sFile;
|
||||
}
|
||||
}
|
||||
closedir($hDir);
|
||||
}
|
||||
closedir($hDir);
|
||||
}
|
||||
|
||||
return $aDictionaries;
|
||||
@@ -2898,4 +2904,4 @@ class MFParameters
|
||||
|
||||
return $merged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,17 +134,20 @@ class ModuleDiscovery
|
||||
{
|
||||
$sModuleName = $aMatches[1];
|
||||
$sDir = dirname($sFilePath);
|
||||
if ($hDir = opendir($sDir))
|
||||
foreach (array($sDir, $sDir.'/dictionary') as $sRootDir)
|
||||
{
|
||||
while (($sFile = readdir($hDir)) !== false)
|
||||
if ($hDir = @opendir($sRootDir))
|
||||
{
|
||||
$aMatches = array();
|
||||
if (preg_match("/^[^\\.]+.dict.$sModuleName.php$/i", $sFile, $aMatches)) // Dictionary files named like <Lang>.dict.<ModuleName>.php are loaded automatically
|
||||
while (($sFile = readdir($hDir)) !== false)
|
||||
{
|
||||
self::$m_aModules[$sId]['dictionary'][] = self::$m_sModulePath.'/'.$sFile;
|
||||
$aMatches = array();
|
||||
if (preg_match("/^[^\\.]+.dict.$sModuleName.php$/i", $sFile, $aMatches)) // Dictionary files named like <Lang>.dict.<ModuleName>.php are loaded automatically
|
||||
{
|
||||
self::$m_aModules[$sId]['dictionary'][] = $sRootDir.'/'.$sFile;
|
||||
}
|
||||
}
|
||||
closedir($hDir);
|
||||
}
|
||||
closedir($hDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user