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/zaklada/wp-content/plugins/wpml-string-translation/classes/class-wpml-st-settings.php
<?php

class WPML_ST_Settings {
	const SETTINGS_KEY = 'icl_st_settings';

	/**
	 * @var array
	 */
	private $settings = null;

	/**
	 * @var array
	 */
	private $updated_settings = array();

	/**
	 * @return array
	 */
	public function get_settings() {
		if ( ! $this->settings ) {
			$options        = get_option( self::SETTINGS_KEY );
			$this->settings = is_array( $options ) ? $options : array();
		}

		return array_merge( $this->settings, $this->updated_settings );
	}

	/**
	 * @param string $name
	 *
	 * @return mixed|null
	 */
	public function get_setting( $name ) {
		$this->get_settings();

		return isset( $this->settings[ $name ] ) ? $this->settings[ $name ] : null;
	}

	/**
	 * @param string $key
	 * @param mixed $value
	 * @param bool $save
	 */
	public function update_setting( $key, $value, $save = false ) {
		$this->get_settings();

		$this->updated_settings[ $key ] = $value;

		if ( $save ) {
			$this->save_settings();
		}
	}

	public function delete_settings() {
		delete_option( self::SETTINGS_KEY );
	}
	
	public function save_settings() {
		$settings = $this->get_settings();

		update_option( self::SETTINGS_KEY, $settings );
		do_action( 'icl_save_settings', $this->updated_settings );
		
		$this->updated_settings = array();
		$this->settings = $settings;
	}
}