summaryrefslogtreecommitdiff
path: root/framework/I18N/core/Gettext/PO.php
diff options
context:
space:
mode:
authorxue <>2007-01-17 22:26:53 +0000
committerxue <>2007-01-17 22:26:53 +0000
commitcd236d693d1df3e20c370c97a98c51ba3fcbd610 (patch)
tree4b84a25cc06db000420b75f2ce1f390246869662 /framework/I18N/core/Gettext/PO.php
parent74acb5d2a4426cb4ae7f0fdd86e23c1459813a60 (diff)
Added PRADO_CHMOD constant so that users can specify the permission of PRADO-created directories
Diffstat (limited to 'framework/I18N/core/Gettext/PO.php')
-rw-r--r--framework/I18N/core/Gettext/PO.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/framework/I18N/core/Gettext/PO.php b/framework/I18N/core/Gettext/PO.php
index 7df99496..66c4596f 100644
--- a/framework/I18N/core/Gettext/PO.php
+++ b/framework/I18N/core/Gettext/PO.php
@@ -32,22 +32,22 @@
/**
* File::Gettext::PO
- *
+ *
* @author Michael Wallner <mike@php.net>
* @license PHP License
*/
-
+
require_once dirname(__FILE__).'/TGettext.php';
-/**
+/**
* File_Gettext_PO
*
* GNU PO file reader and writer.
- *
+ *
* @author Michael Wallner <mike@php.net>
* @version $Revision: 1.2 $
* @access public
- * @package System.I18N.core
+ * @package System.I18N.core
*/
class TGettext_PO extends TGettext
{
@@ -75,13 +75,13 @@ class TGettext_PO extends TGettext
if (!isset($file)) {
$file = $this->file;
}
-
+
// load file
if (!$contents = @file($file)) {
return false;
}
$contents = implode('', $contents);
-
+
// match all msgid/msgstr entries
$matched = preg_match_all(
'/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+' .
@@ -89,11 +89,11 @@ class TGettext_PO extends TGettext
$contents, $matches
);
unset($contents);
-
+
if (!$matched) {
return false;
}
-
+
// get all msgids and msgtrs
for ($i = 0; $i < $matched; $i++) {
$msgid = preg_replace(
@@ -102,16 +102,16 @@ class TGettext_PO extends TGettext
'/\s*msgstr\s*"(.*)"\s*/s', '\\1', $matches[4][$i]);
$this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
}
-
+
// check for meta info
if (isset($this->strings[''])) {
$this->meta = parent::meta2array($this->strings['']);
unset($this->strings['']);
}
-
+
return true;
}
-
+
/**
* Save PO file
*
@@ -150,11 +150,11 @@ class TGettext_PO extends TGettext
'msgstr "' . parent::prepare($t, true) . '"' . "\n\n"
);
}
-
+
//done
@flock($fh, LOCK_UN);
@fclose($fh);
- chmod($file,0777);
+ chmod($file,PRADO_CHMOD);
return true;
}
}