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

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

- Page: https://pluginprobe.com/plugins/double-opt-in/3.0.3/code/core/UIPage.class.php
- Raw: https://pluginprobe.com/plugins/double-opt-in/3.0.3/raw/core/UIPage.class.php
- Modified: 2024-08-13T13:52:36+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/3.0.3/code/core/UIPage.class.php#L10-L20`.

```php
<?php

namespace forge12\contactform7\CF7DoubleOptIn {
	if ( ! defined( 'ABSPATH' ) ) {
		exit;
	}

	/**
	 * Class UIPage
	 */
	abstract class UIPage {
		/**
		 * @var string
		 */
		protected $domain;
		/**
		 * @var string
		 */
		protected $slug;
		/**
		 * @var string
		 */
		protected $title;
		/**
		 * @var string
		 */
		protected $class;
		/**
		 * @var int
		 */
		protected $position = 0;
		/**
		 * @var TemplateHandler
		 */
		protected TemplateHandler $TemplateHandler;

		/**
		 * __construct method initializes an instance of the class.
		 *
		 * @param TemplateHandler $templateHandler - The TemplateHandler object used for handling templates.
		 * @param string          $domain          - The domain of the current page.
		 * @param string          $slug            - The WordPress slug used for the current page.
		 * @param string          $title           - The title of the sidebar.
		 * @param int             $position        - (optional) The position of the sidebar. Default is 10.
		 * @param string          $class           - (optional) The class of the sidebar. Default is an empty string.
		 *
		 * @return void
		 */
		public function __construct( TemplateHandler $templateHandler, string $domain, string $slug, string $title, int $position = 10, string $class = '' ) {
			$this->TemplateHandler = $templateHandler;
			$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;
		}

		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 );
		}
	}
}
```
