HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
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/zaklada/wp-content/plugins/wpml-string-translation/classes/MO/Hooks/PreloadThemeMoFile.php
<?php

namespace WPML\ST\MO\Hooks;

use WPML\Collect\Support\Collection;

class PreloadThemeMoFile implements \IWPML_Action {
	/** @var \SitePress */
	private $sitepress;

	/** @var \wpdb */
	private $wpdb;

	public function __construct( \SitePress $sitepress, \wpdb $wpdb ) {
		$this->sitepress = $sitepress;
		$this->wpdb      = $wpdb;
	}


	public function add_hooks() {
		$domains = $this->sitepress->get_setting( 'gettext_theme_domain_name' );
		$domains = \wpml_collect( array_map( 'trim', explode( ',', $domains ) ) );

		if ( (bool) $this->sitepress->get_setting( 'theme_localization_load_textdomain' ) && $domains->count() ) {

			\wpml_collect( $domains )->each( function ( $domain ) {
				$this->getListOfFiles( $domain, get_locale() )->map( function ( $file ) use ( $domain ) {
					load_textdomain( $domain, $file );
				} );
			} );
		}
	}

	/**
	 * @param string $domain
	 * @param string $locale
	 *
	 * @return Collection
	 */
	private function getListOfFiles( $domain, $locale ) {
		$sql = "
			SELECT file_path
			FROM {$this->wpdb->prefix}icl_mo_files_domains
			WHERE domain = %s and file_path LIKE %s
		";

		$sql = $this->wpdb->prepare( $sql, $domain, '%' . $locale . '%' );

		return \wpml_collect( $this->wpdb->get_row( $sql ) );
	}
}