code style
This commit is contained in:
parent
918de8f0c4
commit
afaa111d22
@ -386,7 +386,7 @@ class i18n
|
|||||||
protected static function _matchLanguage($a, $b) {
|
protected static function _matchLanguage($a, $b) {
|
||||||
$a = explode('-', $a);
|
$a = explode('-', $a);
|
||||||
$b = explode('-', $b);
|
$b = explode('-', $b);
|
||||||
for ($i=0, $n=min(count($a), count($b)); $i<$n; $i++)
|
for ($i=0, $n = min(count($a), count($b)); $i < $n; ++$i)
|
||||||
{
|
{
|
||||||
if ($a[$i] !== $b[$i]) break;
|
if ($a[$i] !== $b[$i]) break;
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,16 @@ abstract class persistence
|
|||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
* @param string $filename
|
* @param string $filename
|
||||||
* @return void
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getPath($filename = null)
|
public static function getPath($filename = null)
|
||||||
{
|
{
|
||||||
if(strlen($filename)) {
|
if (strlen($filename))
|
||||||
|
{
|
||||||
return self::$_path . DIRECTORY_SEPARATOR . $filename;
|
return self::$_path . DIRECTORY_SEPARATOR . $filename;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return self::$_path;
|
return self::$_path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +119,8 @@ abstract class persistence
|
|||||||
self::_initialize();
|
self::_initialize();
|
||||||
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
||||||
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
||||||
if ($writtenBytes === false || $writtenBytes < strlen($data)) {
|
if ($writtenBytes === false || $writtenBytes < strlen($data))
|
||||||
|
{
|
||||||
throw new Exception('unable to write to file ' . $file, 13);
|
throw new Exception('unable to write to file ' . $file, 13);
|
||||||
}
|
}
|
||||||
@chmod($file, 0640); // protect file access
|
@chmod($file, 0640); // protect file access
|
||||||
|
Loading…
Reference in New Issue
Block a user