Skip to content

Commit 8193f7a

Browse files
committed
Fixes static methods calls and declarations in PO / MO classes
Fixes #4
1 parent d14bc0e commit 8193f7a

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/MO.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function get_byteorder($magic)
159159

160160
public function import_from_reader($reader)
161161
{
162-
$endian_string = MO::get_byteorder($reader->readint32());
162+
$endian_string = $this->get_byteorder($reader->readint32());
163163
if (false === $endian_string) {
164164
return false;
165165
}

src/PO.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function export_headers()
3535
}
3636
$poified = PO::poify($header_string);
3737
if ($this->comments_before_headers)
38-
$before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# ');
38+
$before_headers = PO::prepend_each_line(rtrim($this->comments_before_headers)."\n", '# ');
3939
else
4040
$before_headers = '';
4141

@@ -189,11 +189,11 @@ public static function prepend_each_line($string, $with)
189189
* @param string $char character to denote a special PO comment,
190190
* like :, default is a space
191191
*/
192-
private function comment_block($text, $char=' ')
192+
private static function comment_block($text, $char=' ')
193193
{
194-
$text = wordwrap($text, PO::MAX_LINE_LEN - 3);
194+
$text = wordwrap($text, self::MAX_LINE_LEN - 3);
195195

196-
return PO::prepend_each_line($text, "#$char ");
196+
return self::prepend_each_line($text, "#$char ");
197197
}
198198

199199
/**
@@ -207,20 +207,20 @@ public static function export_entry(&$entry)
207207
{
208208
if (is_null($entry->singular)) return false;
209209
$po = array();
210-
if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
211-
if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
212-
if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
213-
if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
214-
if (!is_null($entry->context)) $po[] = 'msgctxt '.PO::poify($entry->context);
215-
$po[] = 'msgid '.PO::poify($entry->singular);
210+
if (!empty($entry->translator_comments)) $po[] = self::comment_block($entry->translator_comments);
211+
if (!empty($entry->extracted_comments)) $po[] = self::comment_block($entry->extracted_comments, '.');
212+
if (!empty($entry->references)) $po[] = self::comment_block(implode(' ', $entry->references), ':');
213+
if (!empty($entry->flags)) $po[] = self::comment_block(implode(", ", $entry->flags), ',');
214+
if (!is_null($entry->context)) $po[] = 'msgctxt '.self::poify($entry->context);
215+
$po[] = 'msgid '.self::poify($entry->singular);
216216
if (!$entry->is_plural) {
217217
$translation = empty($entry->translations)? '' : $entry->translations[0];
218-
$po[] = 'msgstr '.PO::poify($translation);
218+
$po[] = 'msgstr '.self::poify($translation);
219219
} else {
220-
$po[] = 'msgid_plural '.PO::poify($entry->plural);
220+
$po[] = 'msgid_plural '.self::poify($entry->plural);
221221
$translations = empty($entry->translations)? array('', '') : $entry->translations;
222222
foreach ($translations as $i => $translation) {
223-
$po[] = "msgstr[$i] ".PO::poify($translation);
223+
$po[] = "msgstr[$i] ".self::poify($translation);
224224
}
225225
}
226226

@@ -359,7 +359,7 @@ public function read_entry($f, $lineno = 0)
359359
return array('entry' => $entry, 'lineno' => $lineno);
360360
}
361361

362-
public function read_line($f, $action = 'read')
362+
public static function read_line($f, $action = 'read')
363363
{
364364
static $last_line = '';
365365
static $use_last_line = false;

0 commit comments

Comments
 (0)