<?php

namespace Wpupgrader\WordPress\Plugins\GdprConsentLite\Settings;

use Wpupgrader\Libraries\WordPress\Plugins\Core\BaseConfig;
use Wpupgrader\WordPress\Plugins\GdprConsentPlugin\GdprConsentPlugin;

class Page extends \Wpupgrader\Libraries\WordPress\Plugins\Core\Settings\Page
{
    const PAGE_SLUG = "gdpr-consent-settings";

    public function __construct(BaseConfig $config)
    {
        parent::__construct($config);
    }

    public function add_plugin_page()
    {
        \add_submenu_page('edit.php?post_type=gdprc_consent', $this->getSettingsName(), \__('Settings', 'gdprc_consent'), 'manage_options', 'options-general.php?page='.self::PAGE_SLUG, [$this, 'create_admin_page']);
    }

    public function getSettingsDescription()
    {
        echo '<h3 style="margin-bottom: 1.5em;">Did you check our Quick Start Guide? <a href="https://www.wpupgrader.com/gdpr-consent-plugin-documentation/" target="_blank">'.\__('View documentation', 'gdprc_consent').'</a></h3>';

        if (!empty($_GET["gdpr-settings"]) && \sanitize_key($_GET["gdpr-settings"]) == 'not-configured') {
            unset($_GET["gdpr-settings"]);
            echo \sprintf('<div class="notice notice-warning"><h1><i class="gdpri gdpri-warning"></i> GDPR SETTINGS PAGE NOT CONFIGURED <i class="gdpri gdpri-warning"></i></h1><p>%s</p></div>', (\__("<b>Whoops!</b> Please update the <b>Consent Settings page</b> setting in <u>Consent Settings Page</u> tab, or disable the Permission Bar in <u>Permission Bar Settings</u> tab.<br /><br /> <a href='/wp-admin/edit.php?post_type=gdprc_consent&page=options-general.php%3Fpage%3Dgdpr-consent-settings'><b>[ Refresh this page ]</b></a>", "gdprc_consent")));
        }
    }

    function getUrl()
    {
        return \admin_url("options-general.php?page=".self::PAGE_SLUG);
    }

    /**
     * Register and add settings
     */
    public function page_body_init()
    {
        if (isset($_POST["submit"]) && !empty($_POST)) {
            \update_option('gdpr-consent-version', GdprConsentPlugin::VERSION);
        }

        /**
         * CONSENTS SETTINGS
         */
        if (\is_multisite()) {
            \add_settings_field('gdprc_consent_interface_multisite', '', [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
                [
                    'type'        => 'html',
                    'description' => \__('<span class="gdprc_plugin_tip"><b><i class="gdpri gdpri-warning"></i> MULTISITE</b><br>You are in a Multisite environment. GDPR works on a per-site bases. Your local Settings and Consents apply for only this subsite. ', 'gdprc_consent'),
                ]
            );
        }

        \add_settings_section('gdprc_section_consent_interface', \__('Consent Settings Page', 'gdprc_consent'), '', $this->getSettingsKey());

        \add_settings_field('gdprc_consent_interface_title', \__('Interface Title', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'    => 'input',
                'name'    => 'gdprc_consent_interface_title',
                'default' => \__('GDPR Consent Settings', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_description', \__('Interface Description', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'    => 'textarea',
                'name'    => 'gdprc_consent_interface_description',
                'default' => \__('Edit your consent settings below.', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_page', '<i class="dashicons dashicons-admin-links"></i> '.\__('Consent Settings page', 'gdprc_consent'), [
            $this, 'callback',
        ], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'        => 'page',
                'name'        => 'gdprc_consent_interface_page',
                'description' => \sprintf(\__('On this page you should place the %s shortcode to show the consent settings.', 'gdprc_consent'), '<code>[gdpr_consent_settings]</code>').'<br>'.\__('Be sure to add a link to your Consent Settings page in an easily accessible place. For instance in your footer menu.'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_apply_button', \__('Apply button label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'    => 'input',
                'name'    => 'gdprc_consent_interface_apply_button',
                'default' => \__('Change my permissions', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_apply_embed', \__('Apply button label for Embeds', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'        => 'input',
                'name'        => 'gdprc_consent_interface_apply_embed',
                'default'     => \__('Accept and show content', 'gdprc_consent'),
                'description' => \__('Button used to accept consent shortcodes <code>[gdpr_consent_embed ids="1,2"]...[/gdpr_consent_embed]</code> for embedded content.', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_embed_disabled', \__('Embed disabled notice', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'        => 'textarea',
                'name'        => 'gdprc_consent_interface_embed_disabled',
                'default'     => \__('<p><i class="gdpri gdpri-ban"></i> No consent. This feature is disabled by GDPR</p>', 'gdprc_consent'),
                'description' => \__('When a plugin is disabled, you may want to also hide its shortcodes.<br />If you wrap these with <code>[gdpr_consent_embed ids="3,4" widget="false"]...[/gdpr_consent_embed]</code> the "Embed disabled notice" text is rendered inplace of the Consent widget.<br />To remove the disabled feature text, empty the field and type just a space.', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_apply_confirmation', \__('Apply button confirmation', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'    => 'input',
                'name'    => 'gdprc_consent_interface_apply_confirmation',
                'default' => \__('All done!', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_show_accept_all', \__('Use Accept All button', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'        => 'tabtoggle',
                'name'        => 'gdprc_consent_interface_show_accept_all',
                'description' => \__('Allow user to accept <b>ALL</b> consents from the Settings page. Be sure to follow GDPR guidelines when enabling this setting. (Tip: Make sure your visitors understand they are not obliged to accept all consents!)'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_accept_all', \__('Accept All button label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'    => 'input',
                'name'    => 'gdprc_consent_interface_accept_all',
                'default' => \__('Accept all', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_landing_page', '<i class="dashicons dashicons-admin-links"></i> '.\__('Accept All redirect', 'gdprc_consent'), [
            $this, 'callback',
        ], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'        => 'page',
                'name'        => 'gdprc_consent_landing_page',
                'description' => \__('When the user clicks on <b>Accept all</b> on the Settings page, the user will be redirected to this page'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_reset_button', \__('Forget me button label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'    => 'input',
                'name'    => 'gdprc_consent_interface_reset_button',
                'default' => \__('Forget my settings', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_reset_confirmation', \__('Forget me button confirmation', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'    => 'input',
                'name'    => 'gdprc_consent_interface_reset_confirmation',
                'default' => \__('Deleted!', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_interface_view_details', \__('View details button label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_interface',
            [
                'type'        => 'input',
                'name'        => 'gdprc_consent_interface_view_details',
                'default'     => \__('View details', 'gdprc_consent'),
                'description' => \__('This button is shown to mobile visitors only, to view consent details.', 'gdprc_consent'),
            ]
        );

        /**
         * Permission Bar
         */
        \add_settings_section('gdprc_section_permission_bar_settings', \__('Permission Bar Settings', 'gdprc_consent'), '', $this->getSettingsKey());

        \add_settings_field('gdprc_permission_bar_enable', \__('Enable Permission Bar', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'tabtoggle',
                'name'        => 'gdprc_permission_bar_enable',
                'description' => \__('When checked the Permission Bar will be displayed on your website. It allows people to easier navigate to the consents page.'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_consents_enable', \__('Add Consent Settings to Permission Bar', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'toggle',
                'name'        => 'gdprc_permission_bar_consents_enable',
                'description' => \__('When checked the Permission Bar will display the <code>[gdpr_consent_settings]</code> tag on the Permission Bar. It allows people to easier give consent without having to navigate to the consents page.'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_title', \__('Bar Title', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'    => 'input',
                'name'    => 'gdprc_permission_bar_title',
                'default' => \__('GDPR Consent', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_desc', \__('Bar Description', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'    => 'textarea',
                'name'    => 'gdprc_permission_bar_desc',
                'default' => \__('Edit your consent settings or view privacy policy.', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_top', \__('Position on top', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'toggle',
                'name'        => 'gdprc_permission_bar_top',
                'description' => \__('When checked the Permission Bar will be displayed at the top of the page.'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_settings_label', \__('Settings button label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'    => 'input',
                'name'    => 'gdprc_permission_bar_settings_label',
                'default' => \__('Settings', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_close_label', \__('Close button label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'input',
                'name'        => 'gdprc_permission_bar_close_label',
                'default'     => \__('Close', 'gdprc_consent'),
                'description' => \__('Tip: You may use any (1 character) e.g. ✖ as label. This will change the Close link, into a Close button at the top right.'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_behavior_accept_all', \__('Use Accept All button', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'tabtoggle',
                'name'        => 'gdprc_permission_bar_behavior_accept_all',
                'description' => \__('Allow user to accept <b>ALL</b> consents from the Permission Bar. Be sure to follow GDPR guidelines when enabling this setting. (Tip: Make sure your visitors understand they are not obliged to accept all consents!)'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_accept_label', \__('Accept All button label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'input',
                'name'        => 'gdprc_permission_bar_accept_label',
                'default'     => \__('Accept all', 'gdprc_consent'),
                'description' => \__('The button label to accept all consents from the Consent Permission Bar.', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_permission_bar_privacy_label', \__('Privacy Policy label', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'input',
                'name'        => 'gdprc_permission_bar_privacy_label',
                'default'     => \__('Privacy policy', 'gdprc_consent'),
                'description' => \__('This text will link to your Privacy Policy Page.', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_privacy_policy_page', '<i class="dashicons dashicons-admin-links"></i> '.\__('Privacy Policy page', 'gdprc_consent'), [
            $this, 'callback',
        ], $this->getSettingsKey(), 'gdprc_section_permission_bar_settings',
            [
                'type'        => 'page',
                'name'        => 'gdprc_privacy_policy_page',
                'description' => \__('Privacy Policy Page may be the same as your Consent Settings page.', 'gdprc_consent').'<br>'.\__('Be sure to add a link to your Privacy Policy page in an easily accessible place. For instance in your footer menu.'),
            ]
        );

        /**
         * THEME SETTINGS (STYLING OPTIONS)
         */

        \add_settings_section('gdprc_section_consent_theme', \__('Theme Settings', 'gdprc_consent'), '', $this->getSettingsKey());

        \add_settings_field('gdprc_section_consent_theme_enable', \__('Enable Custom Theme', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'        => 'tabtoggle',
                'name'        => 'gdprc_section_consent_theme_enable',
                'description' => \__('Use the theme options from GDPR consent, to style your Consents Settings page and Permission Bar'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_titlefont', \__('Title font', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'select',
                'name'    => 'gdprc_consent_theme_titlefont',
                'choices' => [
                    'Arial'           => 'Arial',
                    'Times New Roman' => 'Times New Roman',
                    'Times'           => 'Times',
                    'Courier New'     => 'Courier New',
                    'Courier'         => 'Courier',
                    'Verdana'         => 'Verdana',
                    'Georgia'         => 'Georgia',
                    // 'Palatino'        => 'Palatino',
                    // 'Garamond'        => 'Garamond',
                    // 'Bookman'         => 'Bookman',
                    'Tahoma'          => 'Tahoma',
                    'Trebuchet MS'    => 'Trebuchet MS',
                    'Arial Black'     => 'Arial Black',
                    'Impact'          => 'Impact',
                    'Comic Sans MS'   => 'Comic Sans MS',
                ],
            ]
        );

        \add_settings_field('gdprc_consent_theme_title', \__('Title color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_title',
                'default' => \__('#333333', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_titlesize', \__('Title size', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'select',
                'name'    => 'gdprc_consent_theme_titlesize',
                'choices' => [
                    '10pt' => '10pt',
                    '11pt' => '11pt',
                    '12pt' => '12pt',
                    '13pt' => '13pt',
                    '14pt' => '14pt',
                    '16pt' => '16pt',
                    '18pt' => '18pt',
                    '20pt' => '20pt',
                    '24pt' => '24pt',
                    '28pt' => '28pt',
                    '32pt' => '32pt',
                ],
            ]
        );

        \add_settings_field('gdprc_consent_theme_textfont', \__('Text font', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'select',
                'name'    => 'gdprc_consent_theme_textfont',
                'choices' => [
                    'Arial'           => 'Arial',
                    'Times New Roman' => 'Times New Roman',
                    'Times'           => 'Times',
                    'Courier New'     => 'Courier New',
                    'Courier'         => 'Courier',
                    'Verdana'         => 'Verdana',
                    'Georgia'         => 'Georgia',
                    // 'Palatino'        => 'Palatino',
                    // 'Garamond'        => 'Garamond',
                    // 'Bookman'         => 'Bookman',
                    'Tahoma'          => 'Tahoma',
                    'Trebuchet MS'    => 'Trebuchet MS',
                    'Arial Black'     => 'Arial Black',
                    'Impact'          => 'Impact',
                    'Comic Sans MS'   => 'Comic Sans MS',
                ],
            ]
        );

        \add_settings_field('gdprc_consent_theme_text', \__('Text color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_text',
                'default' => \__('#333333', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_textsize', \__('Text size', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'select',
                'name'    => 'gdprc_consent_theme_textsize',
                'choices' => [
                    '8pt'  => '8pt',
                    '9pt'  => '9pt',
                    '10pt' => '10pt',
                    '11pt' => '11pt',
                    '12pt' => '12pt',
                    '13pt' => '13pt',
                    '14pt' => '14pt',
                    '16pt' => '16pt',
                    '18pt' => '18pt',
                    '20pt' => '20pt',
                ],
            ]
        );

        if (\gdprConsentPluginIsProEdition()) {
            \add_settings_field('gdprc_consent_theme_header_padding', \__('Header padding', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'unitpicker',
                    'name'    => 'gdprc_consent_theme_header_padding',
                    'choices' => ['top', 'bottom', 'left', 'right'],
                    'units'   => [
                        'rem', 'em', 'px', '%',
                        // 'vw',
                        // 'vh',
                    ],
                ]
            );

            /*
            \add_settings_field('gdprc_consent_theme_header_padding_ratio', \__('Header padding ratio', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'select',
                    'name'    => 'gdprc_consent_theme_header_padding_ratio',
                    'inherit' => false,
                    'choices' => [
                        'x'.(string)(1)             => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: 100%',
                        'x'.(string)(.5)            => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: ½th',
                        'x'.(string)(1 / 3)         => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: ⅓rd',
                        'x'.(string)(.25)           => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: ¼th',
                        'x'.(string)(0.61803398875) => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: φ (golden)',
                        'x'.(string)(2 / 3)         => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: ⅔rd',
                        'x'.(string)(.75)           => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: ¾th',
                        'y'.(string)(.5)            => 'Width: ½th'.str_repeat('&nbsp;', 11).'✖ Height: 100%',
                        'y'.(string)(1 / 3)         => 'Width: ⅓rd'.str_repeat('&nbsp;', 11).'✖ Height: 100%',
                        'y'.(string)(.25)           => 'Width: ¼th'.str_repeat('&nbsp;', 11).'✖ Height: 100%',
                        'y'.(string)(0.61803398875) => 'Width: φ (golden) ✖ Height: 100%',
                        'y'.(string)(2 / 3)         => 'Width: ⅔rd'.str_repeat('&nbsp;', 11).'✖ Height: 100%',
                        'y'.(string)(.75)           => 'Width: ¾th'.str_repeat('&nbsp;', 11).'✖ Height: 100%',
                        'x'.(string)(0)             => 'Width: 100%'.str_repeat('&nbsp;', 9).'✖ Height: -',
                        'y'.(string)(0)             => 'Width: 0'.str_repeat('&nbsp;', 16).'✖ Height: 100%',
                    ],
                ]
            );
            */

            \add_settings_field('gdprc_consent_interface_use_shadows', \__('Add Shadow effects', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'        => 'tabtoggle',
                    'name'        => 'gdprc_consent_interface_use_shadows',
                    'description' => \__('Adds shadows to some elements like buttons, containers and titles.'),
                ]
            );

            \add_settings_field('gdprc_consent_theme_shadow_size', \__('Shadow settings', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'unitpicker',
                    'name'    => 'gdprc_consent_theme_shadow_size',
                    'choices' => ['x', 'y', 'size', 'blur'],
                    'default' => [
                        'x'    => '0',
                        'y'    => '0',
                        'size' => '1',
                        'blur' => '7',
                        'unit' => 'px',
                    ],
                    'units'   => [
                        'rem', 'px',
                    ],
                ]
            );
        }

        \add_settings_field('gdprc_consent_theme_background', \__('Background color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_background',
                'default' => \__('#f5f5f5', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_border', \__('Border color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_border',
                'default' => \__('#eeeeee', 'gdprc_consent'),
            ]
        );

        if (\gdprConsentPluginIsProEdition()) {
            \add_settings_field('gdprc_consent_interface_use_rounded_corners', \__('Use Round corners', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'        => 'tabtoggle',
                    'name'        => 'gdprc_consent_interface_use_rounded_corners',
                    'description' => \__('Use rounded corners instead of square corners (default) for GDPR consent theme.'),
                ]
            );

            \add_settings_field('gdprc_consent_theme_corner_size', \__(' Round corners size', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'unitpicker',
                    'name'    => 'gdprc_consent_theme_corner_size',
                    'choices' => ['size'],
                    'default' => [
                        'size' => '7',
                        'unit' => 'px',
                    ],
                    'units'   => [
                        'rem', 'px',
                    ],
                ]
            );
        }

        \add_settings_field('gdprc_consent_theme_consent', \__('Consent color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_consent',
                'default' => \__('#333333', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_consent_textfont', \__('Consent title font', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'select',
                'name'    => 'gdprc_consent_theme_consent_textfont',
                'choices' => [
                    'Arial'           => 'Arial',
                    'Times New Roman' => 'Times New Roman',
                    'Times'           => 'Times',
                    'Courier New'     => 'Courier New',
                    'Courier'         => 'Courier',
                    'Verdana'         => 'Verdana',
                    'Georgia'         => 'Georgia',
                    // 'Palatino'        => 'Palatino',
                    // 'Garamond'        => 'Garamond',
                    // 'Bookman'         => 'Bookman',
                    'Tahoma'          => 'Tahoma',
                    'Trebuchet MS'    => 'Trebuchet MS',
                    'Arial Black'     => 'Arial Black',
                    'Impact'          => 'Impact',
                    'Comic Sans MS'   => 'Comic Sans MS',
                ],
            ]
        );

        \add_settings_field('gdprc_consent_theme_consent_textsize', \__('Consent title size', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'select',
                'name'    => 'gdprc_consent_theme_consent_textsize',
                'choices' => [
                    '8pt'  => '8pt',
                    '9pt'  => '9pt',
                    '10pt' => '10pt',
                    '11pt' => '11pt',
                    '12pt' => '12pt',
                    '13pt' => '13pt',
                    '14pt' => '14pt',
                    '16pt' => '16pt',
                    '18pt' => '18pt',
                    '20pt' => '20pt',
                ],
            ]
        );

        \add_settings_field('gdprc_consent_theme_consent_text', \__('Consent text color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_consent_text',
                'default' => \__('#333333', 'gdprc_consent'),
            ]
        );

        if (\gdprConsentPluginIsProEdition()) {
            \add_settings_field('gdprc_consent_theme_consent_padding', \__('Consents padding', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'unitpicker',
                    'name'    => 'gdprc_consent_theme_consent_padding',
                    'choices' => ['top', 'bottom', 'left', 'right'],
                    'units'   => ['rem', 'em', 'px', '%'],
                ]
            );
            \add_settings_field('gdprc_consent_theme_consent_text_padding', \__('Consent text padding', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'unitpicker',
                    'name'    => 'gdprc_consent_theme_consent_text_padding',
                    'choices' => ['top', 'bottom', 'left', 'right'],
                    'units'   => ['rem', 'em', 'px', '%'],
                ]
            );
        }

        \add_settings_field('gdprc_consent_theme_button', \__('Button color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_button',
                'default' => \__('#222222', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_button_text', \__('Button text color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_button_text',
                'default' => \__('#ffffff', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_button_active', \__('Active color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_button_active',
                'default' => \__('#767676', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_button_text_active', \__('Active text color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_button_text_active',
                'default' => \__('#ffffff', 'gdprc_consent'),
            ]
        );

        if (\gdprConsentPluginIsProEdition()) {
            \add_settings_field('gdprc_consent_theme_button_padding', \__('Button padding', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'unitpicker',
                    'name'    => 'gdprc_consent_theme_button_padding',
                    'choices' => ['top', 'bottom', 'left', 'right'],
                    'units'   => ['rem', 'em', 'px', '%'],
                ]
            );

            \add_settings_field('gdprc_consent_interface_use_toggles', \__('Use Toggles', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'        => 'toggle',
                    'name'        => 'gdprc_consent_interface_use_toggles',
                    'description' => \__('Use toggle switches instead of togglees for accepting consents.'),
                ]
            );
        }

        \add_settings_field('gdprc_consent_theme_consent_checker', \__('Toggle/Checkbox color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_consent_checker',
                'default' => \__('#3a9e69', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_link', \__('Link color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_link',
                'default' => \__('#222222', 'gdprc_consent'),
            ]
        );

        \add_settings_field('gdprc_consent_theme_link_hover', \__('Link hover color', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
            [
                'type'    => 'colorpicker',
                'class'   => 'gdprc_consent_colorpicker',
                'palette' => 'gdprc_consent',
                'name'    => 'gdprc_consent_theme_link_hover',
                'default' => \__('#767676', 'gdprc_consent'),
            ]
        );

        if (\gdprConsentPluginIsProEdition()) {
            \add_settings_field('gdprc_consent_theme_footer_padding', \__('Footer padding', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'    => 'unitpicker',
                    'name'    => 'gdprc_consent_theme_footer_padding',
                    'choices' => ['top', 'bottom', 'left', 'right'],
                    'units'   => ['rem', 'em', 'px', '%'],
                ]
            );

            \add_settings_field('gdprc_consent_interface_use_animations', \__('Add Animation effects', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_theme',
                [
                    'type'        => 'toggle',
                    'name'        => 'gdprc_consent_interface_use_animations',
                    'description' => \__('Add animations effects to some elements like buttons and text elements.'),
                ]
            );
        }

        /**
         * ADVANCED SETTINGS
         */
        if (\gdprConsentPluginIsProEdition()) {
            \add_settings_section('gdprc_section_consent_advanced', \__('Advanced Settings', 'gdprc_consent'), '', $this->getSettingsKey());

            \add_settings_field('gdprc_section_consent_no_icons', \__('Disable Consent Icons', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_advanced',
                [
                    'type'        => 'toggle',
                    'name'        => 'gdprc_section_consent_no_icons',
                    'description' => \__('By checking this option you will <b>disable</b> the Consent Icons completely.'),
                ]
            );

            \add_settings_field('gdprc_refresh_timeout', \__('Refresh Time (ms)', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_advanced',
                [
                    'type'        => 'input',
                    'name'        => 'gdprc_refresh_timeout',
                    'default'     => 800,
                    'description' => \__('Set the time in Milliseconds before a refresh action is executed. (default: 800) that is 0.8 seconds.'),
                ]
            );

            \add_settings_field('gdprc_google_analytics_consent', \__('Google Analytics <sup>Direct</sup>', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_advanced',
                [
                    'type' => 'consent',
                    'name' => 'gdprc_google_analytics_consent',
                ]
            );

            \add_settings_field('gdprc_google_analytics', '', [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_advanced',
                [
                    'type'        => 'codemirror',
                    'mime'        => 'text/javascript',
                    'name'        => 'gdprc_google_analytics',
                    'default'     => \__("/* Paste your Google Analytics JAVASCRIPT here.. */", 'gdprc_consent'),
                    'description' => \__('<div class="gdprc_plugin_tip">The <b>GDPR Consent Plugin</b> provides a way to load your Google Analytics tracking JavaScript <i>directly</i> after the user gives consent. This works different from the &lt;SCRIPT&gt; consent because &lt;SCRIPT&gt; consents are loaded only every page. Google Analytics Direct ONLY TRIGGERS ONCE to allow you to capture "direct traffic" (since Google Analytics is not loaded before consent).</div>', 'gdprc_consent'),
                ]
            );

            \add_settings_field('gdprc_consent_custom_styles', \__('Custom Style Rules (CSS)', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_consent_advanced',
                [
                    'type'        => 'codemirror',
                    'mime'        => 'text/css',
                    'name'        => 'gdprc_consent_custom_styles',
                    'default'     => \__("#gdprc_bar {\n  /* border-top: 2px solid black; */\n}", 'gdprc_consent'),
                    'description' => \__('<div class="gdprc_plugin_tip"><b><i class="gdpri gdpri-warning"></i> DISCLAIMER</b><br>You may add custom CSS styling rules. However, this is an <b>unsupported</b> feature, so use at your own risk!<br>Please do not forget to always start your rules with <code>#gdprc_bar</code> or <code>#gdprc_settings</code></div>', 'gdprc_consent'),
                ]
            );

            /**
             * MAINTENANCE MODE
             */
            // if (\current_user_can('administrator')) {
            \add_settings_section('gdprc_section_maintenance_mode', \__('Maintenance Mode', 'gdprc_consent'), '', $this->getSettingsKey());

            \add_settings_field('gdpr_consent_maintenance_mode', \__('Maintenance Mode', 'gdprc_consent'), [$this, 'callback'], $this->getSettingsKey(), 'gdprc_section_maintenance_mode',
                [
                    'type'        => 'toggle',
                    'name'        => 'gdpr_consent_maintenance_mode',
                    'description' => \__('Turn on/off maintenance mode to <u>hide</u> the plugin from the public (Shows for Admins only). (This also <u>temporarily disables</u> the plugin for the public.)'),
                ]
            );
            // }
        }
    }
}
