ion_from_header( $this->headers['plural-forms'] );
$this->plural_forms = $this->make_plural_form_function( $expression );
}
if ( is_callable( $this->plural_forms ) ) {
/**
* Plural form.
*
* @var int $result Plural form.
*/
$result = call_user_func( $this->plural_forms, $number );
return $result;
}
// Default plural form matches English, only "One" is considered singular.
return ( 1 === $number ? 0 : 1 );
}
/**
* Returns the plural forms expression as a tuple.
*
* @since 6.5.0
*
* @param string $header Plural-Forms header string.
* @return string Plural forms expression.
*/
protected function get_plural_expression_from_header( string $header ): string {
if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) {
return trim( $matches[2] );
}
return 'n != 1';
}
/**
* Makes a function, which will return the right translation index, according to the
* plural forms header.
*
* @since 6.5.0
*
* @param string $expression Plural form expression.
* @return callable(int $num): int Plural forms function.
*/
protected function make_plural_form_function( string $expression ): callable {
try {
$handler = new Plural_Forms( rtrim( $expression, ';' ) );
return array( $handler, 'get' );
} catch ( Exception $e ) {
// Fall back to default plural-form function.
return $this->make_plural_form_function( 'n != 1' );
}
}
/**
* Imports translations from another file.
*
* @since 6.5.0
*
* @param WP_Translation_File $source Source file.
* @return bool True on success, false otherwise.
*/
protected function import( WP_Translation_File $source ): bool {
if ( null !== $source->error() ) {
return false;
}
$this->headers = $source->headers();
$this->entries = $source->entries();
$this->error = $source->error();
return null === $this->error;
}
/**
* Parses the file.
*
* @since 6.5.0
*/
abstract protected function parse_file();
/**
* Exports translation contents as a string.
*
* @since 6.5.0
*
* @return string Translation file contents.
*/
abstract public function export();
}
Fatal error: Uncaught Error: Class 'WP_Translation_File' not found in /var/www/html/helitower.com.br/web/wp-includes/l10n/class-wp-translation-file-mo.php:15
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-settings.php(121): require()
#1 /var/www/html/helitower.com.br/web/wp-config.php(99): require_once('/var/www/html/h...')
#2 /var/www/html/helitower.com.br/web/wp-load.php(50): require_once('/var/www/html/h...')
#3 /var/www/html/helitower.com.br/web/wp-blog-header.php(13): require_once('/var/www/html/h...')
#4 /var/www/html/helitower.com.br/web/index.php(18): require('/var/www/html/h...')
#5 {main}
thrown in /var/www/html/helitower.com.br/web/wp-includes/l10n/class-wp-translation-file-mo.php on line 15
Fatal error: Uncaught Error: Class 'WP_Translation_File' not found in /var/www/html/helitower.com.br/web/wp-includes/l10n/class-wp-translation-file-php.php:15
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-includes/load.php(1497): require_once()
#1 /var/www/html/helitower.com.br/web/wp-includes/class-wp-fatal-error-handler.php(176): wp_load_translations_early()
#2 /var/www/html/helitower.com.br/web/wp-includes/class-wp-fatal-error-handler.php(156): WP_Fatal_Error_Handler->display_default_error_template(Array, false)
#3 /var/www/html/helitower.com.br/web/wp-includes/class-wp-fatal-error-handler.php(60): WP_Fatal_Error_Handler->display_error_template(Array, false)
#4 [internal function]: WP_Fatal_Error_Handler->handle()
#5 {main}
thrown in /var/www/html/helitower.com.br/web/wp-includes/l10n/class-wp-translation-file-php.php on line 15