11 private $encoding=
'utf-8';
17 "/(?m)\[BLOCK\s*([^\]]*)\](.*?)\[ENDBLOCK\s*\\1\]/se",
18 "\$this->memoEntry('\\1','\\2')",
26 $tkey=explode(
"\n",$key);
27 $ttext=explode(
"\n",
"$text");
28 $key=trim(implode(
"\n",array_map(
'po2js::trimquote',$tkey)));
29 $text=trim(implode(
"\n",array_map(
'po2js::trimquote',$ttext)));
31 if ($key && $text) $this->entry[$key]=$text;
33 if (stristr($text,
"charset=ISO-8859") !==
false) {
34 $this->encoding=
'iso';
41 if (file_exists($this->pofile)) {
42 $pocontent=file_get_contents($this->pofile);
45 preg_match_all(
'/^msgid (?P<msgid>".*?)msgstr (?P<msgstr>".*?")\n\n/ms', $pocontent, $matches, PREG_SET_ORDER);
46 foreach($matches as $m) {
49 $this->
memoEntry($m[
'msgid'], $m[
'msgstr']);
58 if (count($this->entry) > 0) {
59 $js=json_encode($this->entry);
60 if ($this->encoding==
"iso") $js=utf8_encode($js);