Uname:
Linux wputd 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:19:16 UTC 2024 x86_64
Software:
Apache/2.4.41 (Ubuntu)
PHP version:
7.4.3-4ubuntu2.24 [ PHP INFO ] PHP os:
Linux
Server Ip:
158.69.144.88
Your Ip:
3.145.79.214
User:
www-data (33) | Group:
www-data (33)
Safe Mode:
OFF
Disable Function:
pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
<?php
/**
* I18N: WP_Translation_File_PHP class.
*
* @package WordPress
* @subpackage I18N
* @since 6.5.0
*/
/**
* Class WP_Translation_File_PHP.
*
* @since 6.5.0
*/
class WP_Translation_File_PHP extends WP_Translation_File {
/**
* Parses the file.
*
* @since 6.5.0
*/
protected function parse_file() {
$this->parsed = true;
$result = include $this->file;
if ( ! $result || ! is_array( $result ) ) {
$this->error = 'Invalid data';
return;
}
if ( isset( $result['messages'] ) && is_array( $result['messages'] ) ) {
foreach ( $result['messages'] as $original => $translation ) {
$this->entries[ (string) $original ] = $translation;
}
unset( $result['messages'] );
}
$this->headers = array_change_key_case( $result );
}
/**
* Exports translation contents as a string.
*
* @since 6.5.0
*
* @return string Translation file contents.
*/
public function export(): string {
$data = array_merge( $this->headers, array( 'messages' => $this->entries ) );
return '<?php' . PHP_EOL . 'return ' . $this->var_export( $data ) . ';' . PHP_EOL;
}
/**
* Outputs or returns a parsable string representation of a variable.
*
* Like {@see var_export()} but "minified", using short array syntax
* and no newlines.
*
* @since 6.5.0
*
* @param mixed $value The variable you want to export.
* @return string The variable representation.
*/
private function var_export( $value ): string {
if ( ! is_array( $value ) ) {
return var_export( $value, true );
}
$entries = array();
$is_list = array_is_list( $value );
foreach ( $value as $key => $val ) {
$entries[] = $is_list ? $this->var_export( $val ) : var_export( $key, true ) . '=>' . $this->var_export( $val );
}
return '[' . implode( ',', $entries ) . ']';
}
}