summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/ffs/DtdFFS.php')
-rw-r--r--MLEB/Translate/ffs/DtdFFS.php40
1 files changed, 18 insertions, 22 deletions
diff --git a/MLEB/Translate/ffs/DtdFFS.php b/MLEB/Translate/ffs/DtdFFS.php
index aed82fca..89c1b84a 100644
--- a/MLEB/Translate/ffs/DtdFFS.php
+++ b/MLEB/Translate/ffs/DtdFFS.php
@@ -26,29 +26,21 @@ class DtdFFS extends SimpleFFS {
*/
public function readFromVariable( $data ) {
preg_match_all( ',# Author: ([^\n]+)\n,', $data, $matches );
- $authors = [];
-
- $count = count( $matches[1] );
- for ( $i = 0; $i < $count; $i++ ) {
- $authors[] = $matches[1][$i];
- }
+ $authors = $matches[1];
preg_match_all( ',<!ENTITY[ ]+([^ ]+)\s+"([^"]+)"[^>]*>,', $data, $matches );
-
- $keys = $matches[1];
- $values = $matches[2];
-
- $messages = [];
-
- $count = count( $matches[1] );
- for ( $i = 0; $i < $count; $i++ ) {
- $messages[$keys[$i]] = str_replace(
- [ '&quot;', '&#34;', '&#39;' ],
- [ '"', '"', "'" ],
- $values[$i] );
- }
-
- $messages = $this->group->getMangler()->mangle( $messages );
+ list( , $keys, $messages ) = $matches;
+ $messages = array_combine(
+ $keys,
+ array_map(
+ function ( $message ) {
+ return html_entity_decode( $message, ENT_QUOTES );
+ },
+ $messages
+ )
+ );
+
+ $messages = $this->group->getMangler()->mangleArray( $messages );
return [
'AUTHORS' => $authors,
@@ -83,7 +75,11 @@ class DtdFFS extends SimpleFFS {
$output .= "<!ENTITY $key \"$trans\">\n";
}
- return $output ? $header . $output : false;
+ if ( $output ) {
+ return $header . $output;
+ }
+
+ return false;
}
protected function doHeader( MessageCollection $collection ) {