HEX
Server: Apache
System: Linux vpshost0650.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User: bandeirantesbomb3 (10068)
PHP: 8.0.7
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: /home/goremar3/public_html/wp-content/plugins/elementor/modules/variables/classes/css-renderer.php
<?php

namespace Elementor\Modules\Variables\Classes;

use Elementor\Modules\Variables\Services\Variables_Service;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class CSS_Renderer {
	private Variables_Service $service;

	public function __construct( Variables_Service $service ) {
		$this->service = $service;
	}

	private function global_variables(): array {
		return $this->service->get_variables_list();
	}

	public function raw_css(): string {
		$list_of_variables = $this->global_variables();

		if ( empty( $list_of_variables ) ) {
			return '';
		}

		$css_entries = $this->css_entries_for( $list_of_variables );

		if ( empty( $css_entries ) ) {
			return '';
		}

		return $this->wrap_with_root( $css_entries );
	}

	private function css_entries_for( array $list_of_variables ): array {
		$entries = [];

		foreach ( $list_of_variables as $variable_id => $variable ) {
			$entry = $this->build_css_variable_entry( $variable_id, $variable );

			if ( empty( $entry ) ) {
				continue;
			}

			$entries[] = $entry;
		}

		return $entries;
	}

	private function build_css_variable_entry( string $id, array $variable ): ?string {
		$variable_name = sanitize_text_field( $id );

		if ( ! array_key_exists( 'deleted_at', $variable ) ) {
			$variable_name = sanitize_text_field( $variable['label'] ?? '' );
		}

		$value = sanitize_text_field( $variable['value'] ?? '' );

		if ( empty( $value ) || empty( $variable_name ) ) {
			return null;
		}

		$entry = "--{$variable_name}:{$value};";

		$additional = apply_filters( 'elementor/variables/css_entry_additional', '', $variable, $id );

		return $entry . $additional;
	}

	private function wrap_with_root( array $css_entries ): string {
		return ':root { ' . implode( ' ', $css_entries ) . ' }';
	}
}