Hunter Black Hat SEO
Server:LiteSpeed
System:Linux raton.hozzt.com 4.18.0-553.144.1.lve.el8.x86_64 #1 SMP Thu Jul 16 08:31:06 UTC 2026 x86_64
User:altinkayamarble (1260)
PHP:7.4.33
Disabled:symlink, show_source, system, virtual, shell_exec,passthru, exec, popen, proc_open, proc_close, proc_nice, proc_terminate,proc_get_status, pfsockopen,allow_url_fopen, posix_getpwuid, eval,posix_setsid, posix_mkfifo, posix_setpgid,posix_setuid, posix_uname,posix_kill,apache_child_terminate, apache_setenv,define_syslog_variables,escapeshellarg, escapeshellcmd, leak, dl, fp, fput,ftp_connect, ftp_exec,ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist,highlight_file, ini_alter, ini_get_all, ini_restore, inject_code
Upload Files
File: /home/altinkayamarble/www/wp-content/plugins/polylang/include/cookie.php
<?php
/**
 * @package Polylang
 */

/**
 * A class to manage manage the language cookie
 *
 * @since 2.9
 */
class PLL_Cookie {
	/**
	 * Parses the cookie parameters.
	 *
	 * @since 2.9
	 *
	 * @param array $args {@see PLL_Cookie::set()}
	 * @return array
	 */
	protected static function parse_args( $args ) {
		/**
		 * Filters the Polylang cookie duration.
		 *
		 * If a cookie duration of 0 is specified, a session cookie will be set.
		 * If a negative cookie duration is specified, the cookie is removed.
		 * /!\ This filter may be fired *before* the theme is loaded.
		 *
		 * @since 1.8
		 *
		 * @param int $duration Cookie duration in seconds.
		 */
		$expiration = (int) apply_filters( 'pll_cookie_expiration', YEAR_IN_SECONDS );

		$defaults = array(
			'expires'  => 0 !== $expiration ? time() + $expiration : 0,
			'path'     => COOKIEPATH,
			'domain'   => COOKIE_DOMAIN, // Cookie domain must be set to false for localhost ( default value for COOKIE_DOMAIN ) thanks to Stephen Harris.
			'secure'   => is_ssl(),
			'httponly' => false,
			'samesite' => 'Lax',
		);

		return wp_parse_args( $args, $defaults );
	}

	/**
	 * Sets the cookie.
	 *
	 * @since 2.9
	 *
	 * @param string $lang Language cookie value.
	 * @param array  $args {
	 *   Optional. Array of arguments for setting the cookie.
	 *
	 *   @type string $path     Cookie path, defaults to COOKIEPATH.
	 *   @type string $domain   Cookie domain, defaults to COOKIE_DOMAIN
	 *   @type bool   $secure   Should the cookie be sent only over https?
	 *   @type bool   $httponly Should the cookie accessed only over http protocol? Defaults to false.
	 *   @type string $samesite Either 'Strict', 'Lax' or 'None', defaults to 'Lax'.
	 * }
	 * @return void
	 */
	public static function set( $lang, $args = array() ) {
		$args = self::parse_args( $args );

		if ( ! headers_sent() && PLL_COOKIE !== false && self::get() !== $lang ) {
			if ( version_compare( PHP_VERSION, '7.3', '<' ) ) {
				$args['path'] .= '; SameSite=' . $args['samesite']; // Hack to set SameSite value in PHP < 7.3. Doesn't work with newer versions.
				setcookie( PLL_COOKIE, $lang, $args['expires'], $args['path'], $args['domain'], $args['secure'], $args['httponly'] );
			} else {
				setcookie( PLL_COOKIE, $lang, $args );
			}
		}
	}

	/**
	 * Returns the language cookie value.
	 *
	 * @since 2.9
	 *
	 * @return string
	 */
	public static function get() {
		return isset( $_COOKIE[ PLL_COOKIE ] ) ? sanitize_key( $_COOKIE[ PLL_COOKIE ] ) : '';
	}
}