HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vm8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: afleverb (1000)
PHP: 7.4.33
Disabled: 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,
Upload Files
File: //var/www/drakkar_site_dev/wp-content/themes/blocksy/admin/helpers/jed-locale-data.php
<?php

if (! function_exists('blocksy_get_json_translation_files')) {
	function blocksy_get_json_translation_files($domain) {
		$cached_mofiles = [];

		$locations = [
			WP_LANG_DIR . '/themes',
			WP_LANG_DIR . '/plugins'
		];

		foreach ($locations as $location) {
			$mofiles = glob($location . '/*.json');

			if (! $mofiles) {
				continue;
			}

			$cached_mofiles = array_merge($cached_mofiles, $mofiles);
		}

		$locale = determine_locale();

		$result = [];

		foreach ($cached_mofiles as $single_file) {
			if (strpos($single_file, $locale) === false) {
				continue;
			}

			$result[] = $single_file;
		}

		return $result;
	}
}

if (! function_exists('blocksy_get_jed_locale_data')) {
	function blocksy_get_jed_locale_data($domain) {
		static $locale = [];

		if (isset($locale[$domain])) {
			return $locale[$domain];
		}

		$translations = get_translations_for_domain($domain);

		$locale[$domain] = [
			'' => [
				'domain' => $domain,
				'lang' => get_user_locale(),
			]
		];

		if (! empty($translations->headers['Plural-Forms'])) {
			$locale[$domain]['']['plural_forms'] = $translations->headers['Plural-Forms'];
		}

		foreach ($translations->entries as $msgid => $entry) {
			$locale[$domain][$entry->key()] = $entry->translations;
		}

		foreach (blocksy_get_json_translation_files('blocksy') as $file_path) {
			$parsed_json = json_decode(
				call_user_func(
					'file' . '_get_contents',
					$file_path
				),
				true
			);

			if (
				! $parsed_json
				||
				! isset($parsed_json['locale_data']['messages'])
			) {
				continue;
			}

			foreach ($parsed_json['locale_data']['messages'] as $msgid => $entry) {
				if (empty($msgid)) {
					continue;
				}

				$locale[$domain][$msgid] = $entry;
			}
		}

		return $locale[$domain];
	}
}