| Server IP : 82.208.35.60 / Your IP : 216.73.216.168 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/d2m/sofident_cz/wp-content/plugins/wpml-string-translation/classes/MO/Hooks/ |
Upload File : |
<?php
namespace WPML\ST\MO\Hooks;
use WPML\ST\TranslationFile\Sync\FileSync;
class Sync implements \IWPML_Frontend_Action, \IWPML_Backend_Action, \IWPML_DIC_Action {
/** @var FileSync */
private $fileSync;
/** @var callable */
private $useFileSynchronization;
public function __construct( FileSync $fileSync, callable $useFileSynchronization ) {
$this->fileSync = $fileSync;
$this->useFileSynchronization = $useFileSynchronization;
}
public function add_hooks() {
if ( call_user_func( $this->useFileSynchronization ) ) {
add_filter(
'override_load_textdomain',
[ $this, 'syncCustomMoFileOnLoadTextDomain' ],
LoadTextDomain::PRIORITY_OVERRIDE - 1,
3
);
}
}
public function syncFile( $domain, $moFile ) {
if ( call_user_func( $this->useFileSynchronization ) ) {
$this->fileSync->sync( $moFile, $domain );
}
}
/**
* @param bool $override
* @param string $domain
* @param string $moFile
*
* @return bool
*/
public function syncCustomMoFileOnLoadTextDomain( $override, $domain, $moFile ) {
$this->fileSync->sync( $moFile, $domain );
return $override;
}
}