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/azvo/wp-content/plugins/sitepress-multilingual-cms/classes/language/Detection/Frontend.php
<?php

namespace WPML\Language\Detection;

use WPML\FP\Maybe;
use WPML\FP\Obj;
use \WPML_Request;
use \WPML_WP_Comments;
use function WPML\FP\System\filterVar;

/**
 * @package    wpml-core
 * @subpackage wpml-requests
 */
class Frontend extends WPML_Request {
	/** @var \WPML_WP_API */
	private $wp_api;

	public function __construct(
		\WPML_URL_Converter $url_converter,
		$active_languages,
		$default_language,
		CookieLanguage $cookieLanguage,
		\WPML_WP_API $wp_api
	) {
		parent::__construct( $url_converter, $active_languages, $default_language, $cookieLanguage );
		$this->wp_api = $wp_api;
	}


	public function get_requested_lang() {
		return $this->wp_api->is_comments_post_page() ? $this->get_comment_language() : $this->get_request_uri_lang();
	}

	/**
	 * @return string
	 */
	private function get_comment_language() {
		return Maybe::of( $_POST )
					->map( Obj::prop( WPML_WP_Comments::LANG_CODE_FIELD ) )
					->map( filterVar( FILTER_SANITIZE_SPECIAL_CHARS ) )
					->getOrElse( $this->default_language );

	}

	protected function get_cookie_name() {
		return $this->cookieLanguage->getFrontendCookieName();
	}
}