Classes

File phpboost/config/CookieBarConfig.class.php

File phpboost/config/CookieBarConfig.class.php

  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 
<?php
/**
 * @package     PHPBoost
 * @subpackage  Config
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Arnaud GENET <elenwii@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2018 10 30
 * @since       PHPBoost 3.0 - 2010 07 07
 * @contributor Julien BRISWALTER <j1.seth@phpboost.com>
 * @contributor mipel <mipel@phpboost.com>
*/

class CookieBarConfig extends AbstractConfigData
{
    const COOKIEBAR_ENABLED             = 'cookiebar_enabled';
    const COOKIEBAR_DURATION            = 'cookiebar_duration';
    const COOKIEBAR_TRACKING_MODE       = 'cookiebar_tracking_mode';
    const COOKIEBAR_CONTENT             = 'cookiebar_content';
    const COOKIEBAR_ABOUTCOOKIE_TITLE   = 'cookiebar_aboutcookie_title';
    const COOKIEBAR_ABOUTCOOKIE_CONTENT = 'cookiebar_aboutcookie_content';

    const NOTRACKING_COOKIE             = 'notracking';
    const TRACKING_COOKIE               = 'tracking';

    public function enable_cookiebar()
    {
        $this->set_property(self::COOKIEBAR_ENABLED, true);
    }

    public function disable_cookiebar()
    {
        $this->set_property(self::COOKIEBAR_ENABLED, false);
    }

    public function is_cookiebar_enabled()
    {
        return $this->get_property(self::COOKIEBAR_ENABLED);
    }

    public function get_cookiebar_duration()
    {
        return $this->get_property(self::COOKIEBAR_DURATION);
    }

    public function set_cookiebar_duration($value)
    {
        $this->set_property(self::COOKIEBAR_DURATION, $value);
    }

    public function get_cookiebar_tracking_mode()
    {
        return $this->get_property(self::COOKIEBAR_TRACKING_MODE);
    }

    public function set_cookiebar_tracking_mode($value)
    {
        $this->set_property(self::COOKIEBAR_TRACKING_MODE, $value);
    }

    public function get_cookiebar_content()
    {
        return $this->get_property(self::COOKIEBAR_CONTENT);
    }

    public function set_cookiebar_content($value)
    {
        $this->set_property(self::COOKIEBAR_CONTENT, $value);
    }

    public function get_cookiebar_aboutcookie_title()
    {
        return $this->get_property(self::COOKIEBAR_ABOUTCOOKIE_TITLE);
    }

    public function set_cookiebar_aboutcookie_title($value)
    {
        $this->set_property(self::COOKIEBAR_ABOUTCOOKIE_TITLE, $value);
    }

    public function get_cookiebar_aboutcookie_content()
    {
        return $this->get_property(self::COOKIEBAR_ABOUTCOOKIE_CONTENT);
    }

    public function set_cookiebar_aboutcookie_content($value)
    {
        $this->set_property(self::COOKIEBAR_ABOUTCOOKIE_CONTENT, $value);
    }

    /**
     * {@inheritdoc}
     */
    public function get_default_values()
    {
        return array(
            self::COOKIEBAR_ENABLED             => true,
            self::COOKIEBAR_DURATION            => 12,
            self::COOKIEBAR_TRACKING_MODE       => self::NOTRACKING_COOKIE,
            self::COOKIEBAR_CONTENT             => LangLoader::get_message('cookiebar-message.notracking', 'user-common'),
            self::COOKIEBAR_ABOUTCOOKIE_TITLE   => LangLoader::get_message('cookiebar-message.aboutcookie.title', 'user-common'),
            self::COOKIEBAR_ABOUTCOOKIE_CONTENT => LangLoader::get_message('cookiebar-message.aboutcookie', 'user-common')
        );
    }

    /**
     * Returns the configuration.
     * @return CookieBarConfig
     */
    public static function load()
    {
        return ConfigManager::load(__CLASS__, 'kernel', 'cookiebar-config');
    }

    /**
     * Saves the configuration in the database. Has it become persistent.
     */
    public static function save()
    {
        ConfigManager::save('kernel', self::load(), 'cookiebar-config');
    }
}
?>
Annonces