diff --git wp-includes/pomo/po.php wp-includes/pomo/po.php
index f9b1623..52dc23b 100644
|
|
class PO extends Gettext_Translations { |
167 | 167 | * @param string $with prepend lines with this string |
168 | 168 | */ |
169 | 169 | public static function prepend_each_line($string, $with) { |
170 | | $php_with = var_export($with, true); |
171 | 170 | $lines = explode("\n", $string); |
172 | | // do not prepend the string on the last empty line, artefact by explode |
173 | | if ("\n" == substr($string, -1)) unset($lines[count($lines) - 1]); |
174 | | $res = implode("\n", array_map(create_function('$x', "return $php_with.\$x;"), $lines)); |
175 | | // give back the empty line, we ignored above |
176 | | if ("\n" == substr($string, -1)) $res .= "\n"; |
177 | | return $res; |
| 171 | $append = ''; |
| 172 | if ( '' === end($lines) ) { |
| 173 | // Last line might be empty because $string was terminated |
| 174 | // with a newline, remove it from the $lines array, |
| 175 | // we'll restore state by re-terminating the string at the end |
| 176 | array_pop($lines); |
| 177 | $append = "\n"; |
| 178 | } |
| 179 | foreach ( $lines as &$line ) { |
| 180 | $line = $with . $line; |
| 181 | } |
| 182 | unset($line); |
| 183 | return implode("\n", $lines) . $append; |
178 | 184 | } |
179 | 185 | |
180 | 186 | /** |