# double-opt-in/2.1.5/core/UIPage.class.php

Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification, version 2.1.5. 143 lines.

- Page: https://pluginprobe.com/plugins/double-opt-in/2.1.5/code/core/UIPage.class.php
- Raw: https://pluginprobe.com/plugins/double-opt-in/2.1.5/raw/core/UIPage.class.php
- Modified: 2022-12-16T11:04:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/double-opt-in/2.1.5/code/core/UIPage.class.php#L10-L20`.

```php
<?php

namespace forge12\contactform7\CF7DoubleOptIn {
    if (!defined('ABSPATH')) {
        exit;
    }

    abstract class UIPage
    {
        /**
         * @var string
         */
        protected $domain;
        /**
         * @var string
         */
        protected $slug;
        /**
         * @var string
         */
        protected $title;
        /**
         * @var string
         */
        protected $class;
        /**
         * @var int
         */
        protected $position = 0;

        /**
         * Constructor
         * @param UI $UI
         * @param string $domain
         */
        public function __construct($domain, $slug, $title, $position = 10, $class = '')
        {
            $this->domain = $domain;
            $this->slug = $slug;
            $this->title = $title;
            $this->class = $class;
            $this->position = $position;

            add_filter('f12_cf7_doubleoptin_settings', array($this, 'getSettings'));
        }

        public function hideInMenu()
        {
            return false;
        }

        public function getPosition()
        {
            return $this->position;
        }

        public function isDashboard()
        {
            return $this->getPosition() == 0;
        }

        public function getDomain()
        {
            return $this->domain;
        }

        public function getSlug()
        {
            return $this->slug;
        }

        public function getTitle()
        {
            return __($this->title, 'double-opt-in');
        }

        public function getClass()
        {
            return $this->class;
        }

        /**
         * @param $settings
         * @return mixed
         */
        public abstract function getSettings($settings);

        /**
         * @param string $slug - The WordPress Slug
         * @param string $page - The Name of the current Page e.g.: license
         * @return void
         */
        protected abstract function theSidebar($slug, $page);

        /**
         * @param string $slug - The WordPress Slug
         * @param string $page - The Name of the current Page e.g.: license
         * @return void
         */
        protected abstract function theContent($slug, $page, $settings);

        /**
         * @return void
         * @private WordPress HOOK
         */
        public function renderContent($slug, $page)
        {
            if ($this->slug != $page) {
                return;
            }

            $settings = CF7DoubleOptIn::getInstance()->getSettings();

            echo esc_html(Messages::getInstance()->getAll());

            do_action('f12_cf7_doubleoptin_ui_'.$page.'_before_box');
            ?>
            <div class="box">
                <?php
                do_action('f12_cf7_doubleoptin_ui_' . $page . '_before_content', $settings);
                $this->theContent($slug, $page, $settings);
                do_action('f12_cf7_doubleoptin_ui_' . $page . '_after_content', $settings);
                ?>
            </div>
            <?php
            do_action('f12_cf7_doubleoptin_ui_'.$page.'_after_box');
        }

        /**
         * @param string $slug
         * @param string $page
         * @return void
         * @private WordPress Hook
         */
        public function renderSidebar($slug, $page)
        {
            if ($this->slug != $page) {
                return;
            }
            $this->theSidebar($slug, $page);
        }
    }
}
```
