Changeset 43635 for trunk/src/wp-includes/pomo/mo.php
- Timestamp:
- 09/12/2018 06:10:42 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pomo/mo.php
r43571 r43635 125 125 fwrite( $fh, pack( 'VV', 0, $current_addr ) ); 126 126 $current_addr++; 127 $originals_table = chr( 0 );127 $originals_table = "\0"; 128 128 129 129 $reader = new POMO_Reader(); 130 130 131 131 foreach ( $entries as $entry ) { 132 $originals_table .= $this->export_original( $entry ) . chr( 0 );132 $originals_table .= $this->export_original( $entry ) . "\0"; 133 133 $length = $reader->strlen( $this->export_original( $entry ) ); 134 134 fwrite( $fh, pack( 'VV', $length, $current_addr ) ); … … 139 139 fwrite( $fh, pack( 'VV', $reader->strlen( $exported_headers ), $current_addr ) ); 140 140 $current_addr += strlen( $exported_headers ) + 1; 141 $translations_table = $exported_headers . chr( 0 );141 $translations_table = $exported_headers . "\0"; 142 142 143 143 foreach ( $entries as $entry ) { 144 $translations_table .= $this->export_translations( $entry ) . chr( 0 );144 $translations_table .= $this->export_translations( $entry ) . "\0"; 145 145 $length = $reader->strlen( $this->export_translations( $entry ) ); 146 146 fwrite( $fh, pack( 'VV', $length, $current_addr ) ); … … 161 161 $exported = $entry->singular; 162 162 if ( $entry->is_plural ) { 163 $exported .= chr( 0 ). $entry->plural;163 $exported .= "\0" . $entry->plural; 164 164 } 165 165 if ( $entry->context ) { 166 $exported = $entry->context . chr( 4 ). $exported;166 $exported = $entry->context . "\4" . $exported; 167 167 } 168 168 return $exported; … … 175 175 function export_translations( $entry ) { 176 176 //TODO: warnings for control characters 177 return $entry->is_plural ? implode( chr( 0 ), $entry->translations ) : $entry->translations[0];177 return $entry->is_plural ? implode( "\0", $entry->translations ) : $entry->translations[0]; 178 178 } 179 179 … … 311 311 function &make_entry( $original, $translation ) { 312 312 $entry = new Translation_Entry(); 313 // look for context314 $parts = explode( chr( 4 ), $original );313 // Look for context, separated by \4. 314 $parts = explode( "\4", $original ); 315 315 if ( isset( $parts[1] ) ) { 316 316 $original = $parts[1]; … … 318 318 } 319 319 // look for plural original 320 $parts = explode( chr( 0 ), $original );320 $parts = explode( "\0", $original ); 321 321 $entry->singular = $parts[0]; 322 322 if ( isset( $parts[1] ) ) { … … 325 325 } 326 326 // plural translations are also separated by \0 327 $entry->translations = explode( chr( 0 ), $translation );327 $entry->translations = explode( "\0", $translation ); 328 328 return $entry; 329 329 }
Note: See TracChangeset
for help on using the changeset viewer.