diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/pomo/mo.php --- a/wp/wp-includes/pomo/mo.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/pomo/mo.php Tue Sep 27 16:37:53 2022 +0200 @@ -37,7 +37,7 @@ * @param string $filename MO file to load * @return bool True if the import from file was successful, otherwise false. */ - function import_from_file( $filename ) { + public function import_from_file( $filename ) { $reader = new POMO_FileReader( $filename ); if ( ! $reader->is_resource() ) { @@ -53,7 +53,7 @@ * @param string $filename * @return bool */ - function export_to_file( $filename ) { + public function export_to_file( $filename ) { $fh = fopen( $filename, 'wb' ); if ( ! $fh ) { return false; @@ -66,7 +66,7 @@ /** * @return string|false */ - function export() { + public function export() { $tmp_fh = fopen( 'php://temp', 'r+' ); if ( ! $tmp_fh ) { return false; @@ -80,7 +80,7 @@ * @param Translation_Entry $entry * @return bool */ - function is_entry_good_for_export( $entry ) { + public function is_entry_good_for_export( $entry ) { if ( empty( $entry->translations ) ) { return false; } @@ -96,16 +96,16 @@ * @param resource $fh * @return true */ - function export_to_file_handle( $fh ) { + public function export_to_file_handle( $fh ) { $entries = array_filter( $this->entries, array( $this, 'is_entry_good_for_export' ) ); ksort( $entries ); $magic = 0x950412de; $revision = 0; $total = count( $entries ) + 1; // All the headers are one entry. - $originals_lenghts_addr = 28; - $translations_lenghts_addr = $originals_lenghts_addr + 8 * $total; + $originals_lengths_addr = 28; + $translations_lengths_addr = $originals_lengths_addr + 8 * $total; $size_of_hash = 0; - $hash_addr = $translations_lenghts_addr + 8 * $total; + $hash_addr = $translations_lengths_addr + 8 * $total; $current_addr = $hash_addr; fwrite( $fh, @@ -114,13 +114,13 @@ $magic, $revision, $total, - $originals_lenghts_addr, - $translations_lenghts_addr, + $originals_lengths_addr, + $translations_lengths_addr, $size_of_hash, $hash_addr ) ); - fseek( $fh, $originals_lenghts_addr ); + fseek( $fh, $originals_lengths_addr ); // Headers' msgid is an empty string. fwrite( $fh, pack( 'VV', 0, $current_addr ) ); @@ -157,7 +157,7 @@ * @param Translation_Entry $entry * @return string */ - function export_original( $entry ) { + public function export_original( $entry ) { // TODO: Warnings for control characters. $exported = $entry->singular; if ( $entry->is_plural ) { @@ -173,7 +173,7 @@ * @param Translation_Entry $entry * @return string */ - function export_translations( $entry ) { + public function export_translations( $entry ) { // TODO: Warnings for control characters. return $entry->is_plural ? implode( "\0", $entry->translations ) : $entry->translations[0]; } @@ -181,7 +181,7 @@ /** * @return string */ - function export_headers() { + public function export_headers() { $exported = ''; foreach ( $this->headers as $header => $value ) { $exported .= "$header: $value\n"; @@ -193,7 +193,7 @@ * @param int $magic * @return string|false */ - function get_byteorder( $magic ) { + public function get_byteorder( $magic ) { // The magic is 0x950412de. // bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565 @@ -214,7 +214,7 @@ * @param POMO_FileReader $reader * @return bool True if the import was successful, otherwise false. */ - function import_from_reader( $reader ) { + public function import_from_reader( $reader ) { $endian_string = MO::get_byteorder( $reader->readint32() ); if ( false === $endian_string ) { return false; @@ -229,7 +229,7 @@ } // Parse header. - $header = unpack( "{$endian}revision/{$endian}total/{$endian}originals_lenghts_addr/{$endian}translations_lenghts_addr/{$endian}hash_length/{$endian}hash_addr", $header ); + $header = unpack( "{$endian}revision/{$endian}total/{$endian}originals_lengths_addr/{$endian}translations_lengths_addr/{$endian}hash_length/{$endian}hash_addr", $header ); if ( ! is_array( $header ) ) { return false; } @@ -240,10 +240,10 @@ } // Seek to data blocks. - $reader->seekto( $header['originals_lenghts_addr'] ); + $reader->seekto( $header['originals_lengths_addr'] ); // Read originals' indices. - $originals_lengths_length = $header['translations_lenghts_addr'] - $header['originals_lenghts_addr']; + $originals_lengths_length = $header['translations_lengths_addr'] - $header['originals_lengths_addr']; if ( $originals_lengths_length != $header['total'] * 8 ) { return false; } @@ -254,13 +254,13 @@ } // Read translations' indices. - $translations_lenghts_length = $header['hash_addr'] - $header['translations_lenghts_addr']; - if ( $translations_lenghts_length != $header['total'] * 8 ) { + $translations_lengths_length = $header['hash_addr'] - $header['translations_lengths_addr']; + if ( $translations_lengths_length != $header['total'] * 8 ) { return false; } - $translations = $reader->read( $translations_lenghts_length ); - if ( $reader->strlen( $translations ) != $translations_lenghts_length ) { + $translations = $reader->read( $translations_lengths_length ); + if ( $reader->strlen( $translations ) != $translations_lengths_length ) { return false; } @@ -311,7 +311,7 @@ * 0x00 as a plural translations separator * @return Translation_Entry Entry instance. */ - function &make_entry( $original, $translation ) { + public function &make_entry( $original, $translation ) { $entry = new Translation_Entry(); // Look for context, separated by \4. $parts = explode( "\4", $original ); @@ -335,14 +335,14 @@ * @param int $count * @return string */ - function select_plural_form( $count ) { + public function select_plural_form( $count ) { return $this->gettext_select_plural_form( $count ); } /** * @return int */ - function get_plural_forms_count() { + public function get_plural_forms_count() { return $this->_nplurals; } }