HEX
Server: Apache
System: Linux www 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64
User: root (0)
PHP: 8.2.1
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
Upload Files
File: /mnt/drbd/www/edenhouse/wp-content/plugins/essential-blocks/includes/Utils/Settings.php
<?php

namespace EssentialBlocks\Utils;

class Settings
{

    private static $instance;

    public static function get_instance()
    {
        if ( null === static::$instance ) {
            static::$instance = new static();
        }
        return static::$instance;
    }

    public static function get( $key, $default = false )
    {
        return get_option( $key, $default );
    }

    public static function save( $key, $value = '' )
    {
        return update_option( $key, $value );
    }

    public static function save_eb_settings( $key, $value = '' )
    {
        $settings   = get_option( 'eb_settings', [  ] );
        $prev_value = null;
        if ( isset( $settings[ $key ] ) ) {
            $prev_value = $settings[ $key ];
        }
        if ( empty( $value ) ) {
            unset( $settings[ $key ] );
        } else {
            $settings[ $key ] = $value;
        }
        /**
         * Fires after save a specific settings key
         *
         * @since 4.5.0
         * @param mixed $value current value of settings
         * @param mixed $prev_value previous value of settings
         */
        do_action( "eb_after_save_{$key}_settings", $value, $prev_value );
        return update_option( 'eb_settings', $settings );
    }

    public static function reset_eb_settings( $key )
    {
        $settings   = get_option( 'eb_settings', [  ] );
        $prev_value = null;
        if ( isset( $settings[ $key ] ) ) {
            $prev_value = $settings[ $key ];
            unset( $settings[ $key ] );
        }
        /**
         * Fires after reset a specific settings key
         *
         * @since 4.5.0
         * @param mixed $value current value of settings
         * @param mixed $prev_value previous value of settings
         */
        do_action( "eb_after_reset_{$key}_settings", $prev_value );
        return update_option( 'eb_settings', $settings );
    }

    public static function set_transient( $key, $value, $expiration = null )
    {
        if ( $expiration === null ) {
            $expiration = HOUR_IN_SECONDS * 6;
        }
        return set_transient( $key, $value, $expiration );
    }

    public static function get_transient( $key )
    {
        return get_transient( $key );
    }

    /**
     * Summary of save_integration
     * @param mixed $type
     * @param mixed $data
     * @return bool
     */
    public static function save_integration( $type, $data = null )
    {
        return false;
    }

    /**
     * Summary of save_blocks_option
     * @param mixed $data
     * @return bool
     */
    public static function save_blocks_option( $data = [  ] )
    {
        /**
         * Sanitize Data
         */
        return update_option( 'essential_all_blocks', $data );
    }
}