| Server IP : 89.108.64.180 / Your IP : 216.73.216.46 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/poseidon-gagra.ru/wp-content/themes/calluna/calluna/inc/ |
Upload File : |
<?php
/**
* WPML Configuration Class
*
*/
if ( ! class_exists( 'Calluna_WPML_Config' ) ) {
class Calluna_WPML_Config {
public function __construct() {
// Register strings for translation
add_action( 'admin_init', array( $this, 'register_strings' ) );
add_action( 'admin_init', array( $this, 'wpml_fix_ajax_install' ) );
// Fix for when users have the Language URL Option on "different domains"
add_filter( 'upload_dir', array( $this, 'convert_base_url' ) );
}
/**
* Registers theme_mod strings into WPML
*/
public function register_strings() {
if ( function_exists( 'icl_register_string' ) && $strings = calluna_register_theme_mod_strings() ) {
foreach( $strings as $string => $default ) {
icl_register_string( 'Theme Mod', $string, get_theme_mod( $string, $default ) );
}
}
}
public function wpml_fix_ajax_install(){
global $sitepress;
if(defined('DOING_AJAX') && DOING_AJAX && isset($_REQUEST['action']) && isset($_REQUEST['lang']) ){
// remove WPML legacy filter, as it is not doing its job for ajax calls
remove_filter('locale', array($sitepress, 'locale'));
add_filter('locale', 'wpml_ajax_fix_locale');
function wpml_ajax_fix_locale($locale){
global $sitepress;
// simply return the locale corresponding to the "lang" parameter in the request
return $sitepress->get_locale($_REQUEST['lang']);
}
}
}
/**
* Fix for when users have the Language URL Option on "different domains"
* which causes cropped images to fail.
* Runs if 'WPML_SUNRISE_MULTISITE_DOMAINS' constant is defined
*
* @since 1.6.0
*/
public function convert_base_url( $param ) {
// Check if WPML is set to multisite domains
if ( defined( 'WPML_SUNRISE_MULTISITE_DOMAINS' ) ) {
global $sitepress;
if ( $sitepress ) {
// Convert upload directory base URL to correct language
$param['baseurl'] = $sitepress->convert_url( $param['baseurl'] );
}
}
// Return param
return $param;
}
}
}
new Calluna_WPML_Config();