mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +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()
|
public function GetDictionaryFiles()
|
||||||
{
|
{
|
||||||
$aDictionaries = array();
|
$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();
|
while (($sFile = readdir($hDir)) !== false)
|
||||||
if (preg_match("/^[^\\.]+.dict.".$this->sName.'.php$/i', $sFile,
|
|
||||||
$aMatches)) // Dictionary files are named like <Lang>.dict.<ModuleName>.php
|
|
||||||
{
|
{
|
||||||
$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;
|
return $aDictionaries;
|
||||||
@@ -466,18 +469,21 @@ class MFDictModule extends MFModule
|
|||||||
public function GetDictionaryFiles()
|
public function GetDictionaryFiles()
|
||||||
{
|
{
|
||||||
$aDictionaries = array();
|
$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();
|
while (($sFile = readdir($hDir)) !== false)
|
||||||
if (preg_match("/^.*dictionary\\.itop.*.php$/i", $sFile,
|
|
||||||
$aMatches)) // Dictionary files are named like <Lang>.dict.<ModuleName>.php
|
|
||||||
{
|
{
|
||||||
$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;
|
return $aDictionaries;
|
||||||
@@ -2898,4 +2904,4 @@ class MFParameters
|
|||||||
|
|
||||||
return $merged;
|
return $merged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,17 +134,20 @@ class ModuleDiscovery
|
|||||||
{
|
{
|
||||||
$sModuleName = $aMatches[1];
|
$sModuleName = $aMatches[1];
|
||||||
$sDir = dirname($sFilePath);
|
$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();
|
while (($sFile = readdir($hDir)) !== false)
|
||||||
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'][] = 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