PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/asktraining.online/wp-content/plugins/gdpr-framework/src/Options/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/asktraining.online/wp-content/plugins/gdpr-framework/src/Options/OptionsBase.php

<?php

namespace Codelight\GDPR\Options;

/**
 * Parent class for options.
 * Adapted from https://carlalexander.ca/designing-classes-wordpress-options-api/
 *
 * Class OptionsBase
 *
 * @package Codelight\GDPR\Options
 */
abstract class OptionsBase
{
    /* @var string */
    protected $prefix = 'gdpr_';

    /**
     * Auto-prefix all options
     *
     * @param $name
     * @return string
     */
    public function prefix($name)
    {   
        // Check for accidental duplicate prefix
        if ("" === strpos($name, $this->prefix)) {
            trigger_error("You appear to have a duplicate prefix for option {$name}", E_USER_NOTICE);
            return $name;
        }

        return $this->prefix . $name;
    }

    /**
     * Checks if the option with the given name exists or not.
     *
     * @param string $name
     *
     * @return bool
     */
    public function has($name)
    {
        return null !== $this->get($name);
    }

    /**
     * Gets the option for the given name. Returns the default value if the value does not exist.
     *
     * @param string $name
     * @param mixed  $default
     *
     * @return mixed
     */
    abstract public function get($name, $default = null);

    /**
     * Removes the option with the given name.
     *
     * @param string $name
     */
    abstract public function delete($name);

    /**
     * Sets an option. Overwrites the existing option if the name is already in use.
     *
     * @param string $name
     * @param mixed  $value
     */
    abstract public function set($name, $value);
}