Check if all the translations are done by dgettext('domframework',
Update locales git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2541 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
24
inifile.php
24
inifile.php
@@ -13,9 +13,11 @@ class inifile
|
||||
public function getFile ($file, $sections=false)
|
||||
{
|
||||
if (! file_exists ($file))
|
||||
throw new \Exception (sprintf (_("File '%s' not found"), $file), 404);
|
||||
throw new \Exception (sprintf (dgettext("domframework",
|
||||
"File '%s' not found"), $file), 404);
|
||||
if (! is_readable ($file))
|
||||
throw new \Exception (sprintf (_("File '%s' not readable"), $file), 500);
|
||||
throw new \Exception (sprintf (dgettext("domframework",
|
||||
"File '%s' not readable"), $file), 500);
|
||||
$res = parse_ini_file ($file, $sections);
|
||||
// The DomFramework is PHP 5.3 compatible. I need to overwrite the bools and
|
||||
// null values. The INI_SCANNER_TYPED is available as PHP 5.6.1
|
||||
@@ -82,7 +84,8 @@ class inifile
|
||||
{
|
||||
if (! is_array ($array))
|
||||
throw new \Exception (
|
||||
_("inifile::setString : provided data is not an array"),
|
||||
dgettext("domframework",
|
||||
"inifile::setString : provided data is not an array"),
|
||||
500);
|
||||
$content = "";
|
||||
if ($sections !== false)
|
||||
@@ -91,7 +94,8 @@ class inifile
|
||||
{
|
||||
if (! is_array ($sub))
|
||||
throw new \Exception (
|
||||
_("inifile::setString : provided data is not an array"),
|
||||
dgettext("domframework",
|
||||
"inifile::setString : provided data is not an array"),
|
||||
500);
|
||||
$content .= "[$section]\n";
|
||||
foreach ($sub as $key=>$val)
|
||||
@@ -102,7 +106,8 @@ class inifile
|
||||
{
|
||||
if (!is_scalar ($v) && ! is_null ($v))
|
||||
throw new \Exception (sprintf (
|
||||
_("Provided value for '%s' is not scalar"),
|
||||
dgettext("domframework",
|
||||
"Provided value for '%s' is not scalar"),
|
||||
$key), 500);
|
||||
if ($v === null) $v = "null";
|
||||
$content .= $key."[$k] = \"$v\"\n";
|
||||
@@ -127,7 +132,8 @@ class inifile
|
||||
{
|
||||
if (!is_scalar ($v) && ! is_null ($v))
|
||||
throw new \Exception (sprintf (
|
||||
_("Provided value for '%s' is not scalar"),
|
||||
dgettext("domframework",
|
||||
"Provided value for '%s' is not scalar"),
|
||||
$key), 500);
|
||||
if ($v === null) $v = "null";
|
||||
$content .= $key."[$k] = \"$v\"\n";
|
||||
@@ -154,10 +160,12 @@ class inifile
|
||||
$dir = basename ($file);
|
||||
if (! file_exists ($dir) || ! is_readable ($dir) || ! is_writeable ($dir))
|
||||
throw new \Exception (sprintf (
|
||||
_("Directory '%s' available or not readable or not writeable"),
|
||||
dgettext("domframework",
|
||||
"Directory '%s' available or not readable or not writeable"),
|
||||
$dir), 500);
|
||||
if (file_exists ($file) && ! is_writeable ($file))
|
||||
throw new \Exception (sprintf (_("File '%s' is not writeable"), $file),
|
||||
throw new \Exception (sprintf (dgettext("domframework",
|
||||
"File '%s' is not writeable"), $file),
|
||||
500);
|
||||
$content = $this->setString ($array, $sections);
|
||||
return file_put_contents ($file, $content);
|
||||
|
||||
Reference in New Issue
Block a user